Attachment 'Gallery2-1.3.5-9.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - Gallery2 parser
4
5 PURPOSE:
6 This parser is used to visualize a couple of images as a thumbnail gallery.
7 Optional a description of an image could be added including WikiName.
8 On default the image name and it's creation date is shown.
9 If you click on a thumbnail you get the webnails shown. By a menue you are able to toggle between the slides.
10
11 CALLING SEQUENCE:
12 {{{
13 #!Gallery2 [columns=columns],[filter=filter],[mode=mode],
14 [show_text=show_text],[show_date=show_date], [show_tools=show_tools],
15 [sort_by_name=sort_by_name],[sort_by_date=sort_by_date], [sort_by_alias=sort_by_alias],
16 [reverse_sort=reverse_sort],
17 [only_items=only_items],[template_itemlist=template_itemlist],
18 [thumbnail_width=thumbnail_width],[webnail_width=webnail_width],[text_width=text_width],
19 [image_for_webnail=image_for_webnail],
20 [border_thick=border_thick],[renew=renew],[help=help]
21 * [image1.jpg alias]
22 * [image2.jpg alias]
23 }}}
24
25 KEYWORD PARAMETERS:
26 columns: number of columns for thumbnails
27 filter: regex to select images
28 show_text: default is 1 description is shown
29 any other means no description
30 show_date: default is 1 date info from exif header if available is shown
31 show_tools: default is 1 icon toolbar is show any other disables this
32 sort_by_name: default is 1, the images are sorted by name, but not if only_items is 1
33 sort_by_date: default is 0, if set to 1 the images are sorted to the modification time
34 sort_by_alias default is 0, if set to 1 and only_items set to 1 it is used to order the images by the alias name
35 reverse_sort: default is 0, if set to 1 the file list is reversed
36 any other means no description
37 mode: default is 1 this means description below the image
38 any other number means description right of image
39 only_items: default is 0 if it is set to 1 only images which are described in listitem are shown
40 dependend on the order of the items
41 template_itemlist: default is 0, if set to 1 an item list is shown which could be copied into the script.
42 border_thick: default is 1 this is the thickness in pixeln of the outer frame
43 renew: default is 0 if set to 1 then all selected thumbnails_* and webnails_* removed.
44 Afterwards they are new created.
45 thumbnail_width: default is 128
46 webnail_width: default is 640
47 text_width: default is 140
48 image_for_webnail default is 0 if set to 1 then the image is shown as preview and not the webnail
49 help: default is 0 if set a copy of the CALLING SEQUENCE is shown,
50 (there are some new ideas around to show help to an user so this will be later replaced)
51
52 OPTIONAL INPUTS:
53 itemlist : if it is used and only_items is 1 then only the images in this list are ahown.
54 The alias text is used as description of the image instead of the file name
55
56
57 EXAMPLE:
58 = GalleryTest =
59
60 == all images shown, one is decribed ==
61 {{{
62 { { {
63 #!Gallery2
64 * [100_1185.JPG Bremen, SpaceCenter]
65 } } }
66 }}}
67
68 Result: [[BR]]
69 {{{
70 #!Gallery2
71 * [100_1185.JPG Bremen, SpaceCenter]
72 }}}
73
74 == only thumbnails and only_items ==
75 {{{
76 { { {
77 #!Gallery2 show_text=0,show_tools=0,show_date=0,columns=2,only_items=1
78 * [100_1185.JPG Bremen, SpaceCenter]
79 * [100_1194.JPG Bremen]
80 } } }
81 }}}
82
83 Result: [[BR]]
84 {{{
85 #!Gallery2 show_text=0,show_tools=0,show_date=0,columns=2,only_items=1
86 * [100_1185.JPG Bremen, SpaceCenter]
87 * [100_1194.JPG Bremen]
88 }}}
89
90 == only_items by two columns and text right ==
91
92 {{{
93 { { {
94 #!Gallery2 mode=2,columns=2,only_items=1
95 * [100_1185.JPG Bremen, SpaceCenter]
96 * [100_1194.JPG Bremen]
97 } } }
98 }}}
99
100 Result: [[BR]]
101 {{{
102 #!Gallery2 mode=2,columns=2,only_items=1
103 * [100_1185.JPG Bremen, SpaceCenter]
104 * [100_1194.JPG Bremen, behind SpaceCenter]
105 }}}
106
107 ----
108
109 == only_items by two columns, date supressed ==
110
111 {{{
112 { { {
113 #!Gallery2 columns=2,only_items=1,show_date=0
114 * [100_1185.JPG Bremen, SpaceCenter]
115 * [100_1194.JPG Bremen, behind SpaceCenter]
116 } } }
117 }}}
118
119 Result: [[BR]]
120 {{{
121 #!Gallery2 columns=2,only_items=1,show_date=0
122 * [100_1185.JPG Bremen, SpaceCenter]
123 * [100_1194.JPG Bremen, behind SpaceCenter]
124 }}}
125
126
127 == filter regex used, mode 2, icons and date supressed, one column and border_thick=5 ==
128 {{{
129 { { {
130 #!Gallery2 columns=1,filter=100_118[0-5],mode=2,show_date=0,show_tools=0,border_thick=5
131 } } }
132 }}}
133
134 Result: [[BR]]
135 {{{
136 #!Gallery2 columns=1,filter=100_118[0-7],mode=2,show_date=0,show_tools=0,border_thick=5
137 }}}
138
139 == other macro calls ==
140 {{{
141 { { {
142 #!Gallery2 only_items=1,show_date=0
143 * [100_1189.JPG [[MiniPage(||Bremen||SpaceCenter||\n|| ||SpaceJump||)]]]
144 } } }
145 }}}
146
147 Result: [[BR]]
148 {{{
149 #!Gallery2 only_items=1,show_date=0
150 * [100_1189.JPG [[MiniPage(||Bremen||SpaceCenter||\n|| ||SpaceJump||)]]]
151 }}}
152
153 == renew means always new thumbnails and webnails of selection ==
154 {{{
155 { { {
156 #!Gallery2 only_items=1,show_date=0,show_tools=0,renew=1
157 * [100_1189.JPG [[MiniPage(||["Bremen"]||SpaceCenter||\n|| ||SpaceJump||)]]]
158 } } }
159 }}}
160
161 Result: [[BR]]
162 {{{
163 #!Gallery2 only_items=1,show_date=0,renew=1
164 * [100_1189.JPG [[MiniPage(||["Bremen"]||SpaceCenter||\n|| ||SpaceJump||)]]]
165 }}}
166
167 == template_itemlist ==
168 {{{
169 { { {
170 #!Gallery2 template_itemlist=1
171 * [100_1185.JPG Bremen, SpaceCenter]
172 } } }
173 }}}
174
175 Result: [[BR]]
176 {{{
177 #!Gallery2 template_itemlist=1
178 * [100_1185.JPG Bremen, SpaceCenter]
179 }}}
180
181 == help to show Calling Sequence ==
182 {{{
183 { { {
184 #!Gallery2 help=1
185 } } }
186 }}}
187
188 Result: [[BR]]
189 {{{
190 #!Gallery2 help=1
191 }}}
192
193
194 PROCEDURE:
195 Download some images to a page and start with the examples.
196 Aliasing of the filenames are done by adding an itemlist, see example.
197
198 This routine requires the PIL (Python Imaging Library).
199 And the EXIF routine from http://home.cfl.rr.com/genecash/digital_camera.html
200
201
202 At the moment I have added the EXIF routine to the parsers dir.
203 It's not the best place but during developing it is nice to have it there
204 If you put it to another place you have to change the line
205 from MoinMoin.parser import EXIF too.
206
207 This routine requires the Action macro gallery2Image which is used to rotate or delete a selected image.
208 Only users which have the rights to delete are able to execute this action macro.
209 The icons of these are only shown if you have enough rights.
210
211 The gallery2image macro does not take care on the EXIF header. This is lost by rotating.
212 If a file is deleted by this macro it is moved to a bak file.
213
214 Please remove the Version number from the code!
215
216 RESTRICTIONS:
217 The movie mode is not implemented at the moment. The implementation will be done in the action macro.
218
219
220 If you rotate an image at the moment the exif is destroyed. PIL ignores the exif header.
221 This is not a quite big problem normally files with an EXIF header are right rotated.
222
223 Required Images:
224 I have put them to wiki/modern/img/ dir. The icons were created by me. License: GPL
225
226 attachment:to_bak.png
227 attachment:to_left.png
228 attachment:to_right.png
229 attachment:to_slide.png
230 attachment:to_full.png
231
232 HISTORY:
233 While recognizing how to write MiniPage I got the idea to write a Gallery Parser.
234 We have used in our wikis in the past the Gallery macro of SimonRyan.
235 I have tried to modify it a bit to change it for 1.3 but my python skills weren't enough
236 or it was easier to write it completly new.
237 So this one shows now a way how a Gallery could be used by the parser and an action Macro.
238 Probably it is a good example for others who like to know how to do this
239
240 MODIFICATION HISTORY:
241 Version 1.3.3.-1
242 @copyright: 2005 by Reimar Bauer (R.Bauer@fz-juelich.de)
243 @license: GNU GPL, see COPYING for details.
244 2005-03-26: Version 1.3.3-2 keyword renew added
245 creation of thumbnails and webnails in two calls splitted
246 Version 1.3.3-3 bug fixed if itemlist is given to describe only some of the images
247 but only_items is not set to 1
248 Example code changed
249 2005-03-27: Version 1.3.3-4 Action macro added and the form to call it. User which have rights to delete
250 could use the functions of gallery2Image.
251 2005-08-03: Version 1.3.3-5 theme path for icons corrected and a platform independent path joining
252 os.unlink removed as suggested by CraigJohnson
253 sort_by_name is default if not only_items is 1
254 optional sort_by_date could be used
255 keyword template_itemlist added
256 keyword help added
257 extra frame by mode=2 removed
258 2005-08-06: Version 1.3.5-6 slideshow mode added
259 keyword image_for_webnail added
260 2005-08-13: Version 1.3.5-7 syntax changed from GET to POST
261 forms instead of links
262 filenames from images submitted to gallery2image too
263 new keyword sort_by_alias
264 internal code clean up
265 this version needs: gallery2image-1.3.5-5.py
266 2005-08-14: Version 1.3.5-8 (TW) cleanup
267 2005-08-14: Version 1.3.5-9 html code for tables changed
268 because of the ugly extra space of form elements
269 </div> tag removed so now we use the page style
270 slide show action goes to right webnail now
271 this version needs: gallery2image-1.3.5-5.py
272
273 """
274 Dependencies = []
275 from MoinMoin.action import AttachFile
276 from MoinMoin import wikiutil, config
277 from MoinMoin.Page import Page
278
279 import os,string,re,Image,StringIO
280
281 from MoinMoin.parser import EXIF
282
283 from MoinMoin.parser import wiki
284
285
286 def get_files(kw,path,files,quotes,request):
287 web=[]
288 full=[]
289 thumb=[]
290 exif_date=[]
291 img_type=[]
292 description=[]
293
294
295 ddict={}
296 n=len(quotes['image'])
297 if n > 0 :
298 i = 0
299 for txt in quotes['image']:
300 ddict[txt]=quotes['alias'][i]
301 i += 1
302
303 for attfile in files:
304 # only files not thumb or webnails
305 if attfile.find('thumbnail_') == -1 and attfile.find('webnail_') == -1:
306 # only images
307 if wikiutil.isPicture(attfile):
308 description.append(ddict.get(attfile, attfile))
309 full.append(attfile)
310
311 if kw['image_for_webnail'] == '1':
312 webnail = attfile
313 else:
314 fname, ext = os.path.splitext(attfile)
315 if ext in ('.gif', '.png'):
316 img_type.append('PNG')
317 webnail = 'webnail_%s.png' % fname
318 thumbfile = 'thumbnail_%s.png' % fname
319 else:
320 img_type.append("JPEG")
321 webnail = 'webnail_%s.jpg' % fname
322 thumbfile = 'thumbnail_%s.jpg' % fname
323
324 infile = os.path.join(path, attfile)
325 if os.path.exists(infile):
326 web.append(webnail)
327 thumb.append(thumbfile)
328
329 f = open(infile, 'rb')
330 tags = EXIF.process_file(f)
331 if tags.has_key('EXIF DateTimeOriginal'):
332 date = str(tags['EXIF DateTimeOriginal'])
333 date = date.replace(':', '-', 2)
334 else:
335 date = '--'
336 exif_date.append(date)
337 f.close()
338
339
340 return thumb,web,full,exif_date,img_type,description
341
342 def to_htmltext(text):
343 text = text.split(' ')
344 text = ' '.join(text)
345 return text
346
347 def to_wikiname(request,formatter,text):
348 ##taken from MiniPage
349 out=StringIO.StringIO()
350 request.redirect(out)
351 wikiizer = wiki.Parser(text.strip(),request)
352 wikiizer.format(formatter)
353 result=out.getvalue()
354 request.redirect()
355 del out
356
357 return result.strip()
358
359
360 def get_quotes(self,formatter):
361 quotes = self.raw.split('\n')
362 quotes = [quote.strip() for quote in quotes]
363 quotes = [quote[2:] for quote in quotes if quote.startswith('* ')]
364
365
366 image=[]
367 text=[]
368
369 for line in quotes:
370 im, na=line[1:-1].split(' ',1)
371 text.append(na.strip())
372 image.append(im.strip())
373
374 return {
375 'alias': text,
376 'image': image,
377 }
378
379
380
381 class Parser:
382
383 def __init__(self, raw, request, **kw):
384 self.raw = raw
385 self.request = request
386 self.form = request.form
387 self._ = request.getText
388 self.kw = {
389 'sort_by_date': '0',
390 'sort_by_name': '1',
391 'sort_by_alias': '0',
392 'template_itemlist': '0',
393 'reverse_sort': '0',
394 'border_thick': '1',
395 'columns': '4',
396 'filter': '.',
397 'mode': '1',
398 'help': '0',
399 'show_text': '1',
400 'show_date': '1',
401 'show_tools': '1',
402 'only_items': '0',
403 'image_for_webnail': '0',
404 'renew': '0',
405 'thumbnail_width': '128',
406 'webnail_width': '640',
407 'text_width': '140',
408 }
409
410
411 for arg in kw.get('format_args','').split(','):
412
413 if arg.find('=') > -1:
414 key, value=arg.split('=')
415 self.kw[key]=wikiutil.escape(value, quote=1)
416
417
418 self.kw['width']=str((int(self.kw['thumbnail_width'])+int(self.kw['text_width'])))
419
420
421 def format(self, formatter):
422 kw=self.kw
423 Dict = {}
424 quotes=get_quotes(self,formatter)
425 current_pagename=formatter.page.page_name
426 attachment_path = AttachFile.getAttachDir(self.request, current_pagename, create=1)
427
428 if kw['help'] == '1':
429 self.request.write('''
430 <br>
431 {{{<br>
432 #!Gallery2 [columns=columns],[filter=filter],[mode=mode],<br>
433 [show_text=show_text],[show_date=show_date], [show_tools=show_tools],<br>
434 [sort_by_name=sort_by_name],[sort_by_date=sort_by_date],[sort_by_alias=sort_by_alias]<br>
435 [reverse_sort=reverse_sort],<br>
436 [only_items=only_items],[template_itemlist=template_itemlist],<br>
437 [thumbnail_width=thumbnail_width],[webnail_width=webnail_width],[text_width=text_width],<br>
438 [image_for_webnail=image_for_webnail],<br>
439 [border_thick=border_thick],[renew=renew],[help=help]<br>
440 * [image1.jpg alias]<br>
441 * [image2.jpg alias]<br>
442 }}}<br>''')
443 return
444
445
446 if kw['only_items'] == '1':
447 all_files=quotes['image']
448
449 if kw['sort_by_alias'] == '1':
450 new_ordered_files=[]
451 alias_text=quotes['alias']
452
453 i=0
454 for attfile in all_files:
455 infile=os.path.join(attachment_path,attfile)
456 ft_file=str(os.path.getmtime(infile))+os.tmpnam()
457 Dict[alias_text[i]]=attfile
458 i += 1
459
460 keys = Dict.keys()
461 keys.sort()
462 for txt in keys:
463 new_ordered_files.append(Dict[txt])
464
465
466 all_files=new_ordered_files
467 Dict.clear()
468
469 else:
470 all_files=os.listdir(attachment_path)
471
472 result = []
473
474 for test in all_files:
475 if re.match(kw['filter'], test):
476 result.append(test)
477 all_files=result
478
479 if not all_files:
480 self.request.write("<br><br><h1>No matching image file found!</h1>")
481 return
482
483
484
485 if kw['sort_by_name'] == '1' and kw['only_items'] == '0':
486 all_files.sort()
487
488 if kw['sort_by_date']=='1':
489 for attfile in all_files:
490 infile=os.path.join(attachment_path,attfile)
491 ft_file=str(os.path.getmtime(infile))+os.tmpnam()
492 Dict[ft_file]=attfile
493
494 keys = Dict.keys()
495 keys.sort()
496 file_mdate=[]
497 for txt in keys:
498 file_mdate.append(Dict[txt])
499 all_files=file_mdate
500 Dict.clear()
501
502 if kw['reverse_sort']=='1':
503 all_files.reverse()
504
505
506 cells=[]
507 cell_name=[]
508 img=[]
509
510 thumb, web, full, exif_date, imgtype, description = get_files(kw, attachment_path, all_files, quotes, self.request)
511
512 if kw['template_itemlist'] == '1':
513 self.request.write('Copy the following listitems into the script. Replace alias with the label you want. Afterwards disable template_itemlist by setting it to 0:<BR>')
514
515 i=0
516 for attfile in full :
517 thumbfile=thumb[i]
518 img_type=imgtype[i]
519
520 infile=os.path.join(attachment_path,attfile)
521 webnail=web[i]
522 this_description=description[i]
523 this_exif_date=exif_date[i]
524
525 img.append(attfile)
526 if (kw['template_itemlist'] == '1'):
527 self.request.write(' * [%(attfile)s %(date)s]<br>' % {
528 'attfile' : attfile,
529 'date' : 'alias'
530 })
531
532 thumbf=os.path.join(attachment_path,thumbfile)
533 webf=os.path.join(attachment_path,webnail)
534
535 if kw['renew'] == '1':
536 if os.path.exists(thumbf):
537 os.unlink(thumbf)
538 if os.path.exists(webf):
539 os.unlink(webf)
540
541
542 if not os.path.exists(webf) or not os.path.exists(thumbf):
543 im = Image.open(infile)
544 if not os.path.exists(webf):
545 im.thumbnail(((int(kw['webnail_width'])),((int(kw['webnail_width'])))), Image.ANTIALIAS)
546 im.save(webf, img_type)
547 if not os.path.exists(thumbf):
548 im.thumbnail(((int(kw['thumbnail_width'])),((int(kw['thumbnail_width'])))),
549 Image.ANTIALIAS)
550 im.save(thumbf, img_type)
551
552
553 alias_text = "%(this)s,%(all_other)s" % {
554 "this": this_description,
555 "all_other": '","'.join(description)}
556
557
558
559 #text='<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
560 # 'baseurl': self.request.getScriptname(),
561 # 'pagename': wikiutil.quoteWikinameURL(current_pagename)}
562
563 text = '''
564 <input type="hidden" name="action" value="gallery2image">
565 <input type="hidden" name="do" value="VS">
566 <input type="hidden" name="full" value="%(full)s">
567 <input type="hidden" name="alias" value="%(alias)s">
568 <input type="hidden" name="exif_date" value="%(exif_date)s">
569 <input type="hidden" name="target" value="%(target)s">
570 <input type="image" value="submit" src="%(submit)s">
571 ''' % {
572 'full': attfile + "," + ','.join(full),
573 'alias': to_htmltext(this_description + "!,!" + '!,!'.join(description)),
574 'exif_date': to_htmltext(this_exif_date + "," + ','.join(exif_date)),
575 'target': webnail + "," + ','.join(web),
576 'submit': AttachFile.getAttachUrl(current_pagename, thumbfile, self.request),
577 }
578 cells.append(text)
579 cell_name.append(attfile)
580 i += 1
581
582 result = []
583 if len(full) == 0:
584 result.append('Image not found')
585
586 n = len(cells)
587 cols = int(kw['columns'])
588 rows = n/cols
589 first = 0
590 z = 1
591 i = 0
592
593 ############################################
594 ##TODO: syntax change to formatter - later #
595 ############################################
596
597 # fixed width because of better visualisation on different browsers
598 result.append('<table border="'+kw['border_thick']+'" valign="bottom">')
599 result.append('<TR valign="center">')
600 ii=0
601 for line in cells:
602 if z == 1:
603 if cols > 1 and n > 1:
604 if kw['mode'] == '1':
605 result.append('<td width="%(thumbnail_width)s">' % kw)
606 else:
607 result.append('<td width="%(width)s">' % kw)
608 if n > 1 and cols > 1:
609 result.append('<table border="1" valign="center">')
610
611 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
612 'baseurl': self.request.getScriptname(),
613 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
614 result.append('<td align="center" valign="center" width="%(thumbnail_width)s">' % kw)
615
616 result.append(line)
617 result.append(formatter.table_cell(0))
618
619 if kw['mode'] == '1':
620 result.append(formatter.table_row(0))
621 result.append('</form>')
622
623 if kw['show_text'] == '1':
624 if kw['mode'] == '1':
625 result.append(formatter.table_row(0))
626 result.append(formatter.table_row(1))
627 # text aligned left in mode 1
628 result.append('<td align="left" width="%(thumbnail_width)s">' % kw)
629 else:
630 # text aligned on top in mode 2
631 result.append('<td valign="top" width="%(text_width)s">' % kw)
632
633
634 result.append(to_wikiname(self.request,formatter,description[ii]))
635
636 result.append(formatter.table_cell(0))
637 result.append(formatter.table_row(0))
638 #if (kw['mode']=='1'):
639 # result.append(formatter.table_row(0))
640 ii += 1
641
642
643 if kw['show_date'] == '1':
644 if kw['mode'] == '1':
645 result.append(formatter.table_row(1))
646 result.append(formatter.table_cell(1))
647 result.append(exif_date[i])
648 result.append(formatter.table_cell(0))
649 result.append(formatter.table_row(0))
650
651 if kw['show_tools'] == '1':
652 result.append(formatter.table_row(1))
653 # tool bar centriert
654 result.append('<td align="center">')
655
656 result.append('<TABLE align="center">')
657
658 result.append('<TR>')
659 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
660 'baseurl': self.request.getScriptname(),
661 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
662 result.append('<td>')
663
664
665 result.append('<input type="hidden" name="action" value="AttachFile">')
666 result.append('<input type="hidden" name="do" value=get>')
667 result.append('<input type="hidden" name="target" value="'+img[i]+'">')
668 result.append('<input type="image" value="submit" src="/wiki/modern/img/to_full.png" title="load image">')
669 result.append('</td>')
670 result.append('</FORM>')
671
672 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
673 'baseurl': self.request.getScriptname(),
674 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
675
676 result.append('<td>')
677 result.append('<input type="hidden" name="action" value="gallery2image">')
678 result.append('<input type="hidden" name="do" value="VS">')
679 result.append('<input type="hidden" name="full" value="'+full[i]+","+string.join(full,',')+'">')
680 result.append('<input type="hidden" name="alias" value="'+to_htmltext(description[i]+"!,!"+string.join(description,'!,!'))+'">')
681
682 result.append('<input type="hidden" name="target" value="'+web[i]+","+string.join(web,',')+'">')
683 result.append('<input type="hidden" name="exif_date" value="'+to_htmltext(exif_date[i]+","+string.join(exif_date,','))+'">')
684 #result.append('<input type="hidden" name="target" value='+string.join(img,',')+'>')
685 result.append('<input type="image" value="submit" src="/wiki/modern/img/to_slide.png" title="slide_show">')
686
687 result.append('</td>')
688 result.append('</FORM>')
689
690 if self.request.user.may.delete(current_pagename):
691
692
693 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
694 'baseurl': self.request.getScriptname(),
695 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
696 result.append('<td>')
697 result.append('<input type="hidden" name="action" value="gallery2image">')
698 result.append('<input type="hidden" name="do" value="RL">')
699 result.append('<input type="hidden" name="target" value="'+img[i]+'">')
700 result.append('<input type="image" value="submit" src="/wiki/modern/img/to_left.png" title="rotate to left">')
701
702 result.append('</td></FORM>')
703 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
704 'baseurl': self.request.getScriptname(),
705 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
706 result.append('<td>')
707 result.append('<input type="hidden" name="action" value="gallery2image">')
708 result.append('<input type="hidden" name="do" value="RR">')
709 result.append('<input type="hidden" name="target" value="'+img[i]+'">')
710 result.append('<input type="image" value="submit" src="/wiki/modern/img/to_right.png" title="rotate to right">')
711
712 #result.append('</FORM>')
713 result.append('</td></FORM>')
714 result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data">' % {
715 'baseurl': self.request.getScriptname(),
716 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
717 result.append('<td>')
718 result.append('<input type="hidden" name="action" value="gallery2image">')
719 result.append('<input type="hidden" name="do" value="RM">')
720 result.append('<input type="hidden" name="target" value="'+img[i]+'">')
721 result.append('<input type="image" value="submit" src="/wiki/modern/img/to_bak.png" title="move to bak">')
722
723 result.append('</TD>')
724 result.append('</FORM>')
725 result.append('</TR>')
726 result.append('</TABLE>')
727
728
729 result.append(formatter.table_cell(0))
730 if kw['show_date'] == '1':
731 if not kw['mode'] == '1':
732 result.append(formatter.table_cell(1))
733 result.append(exif_date[i])
734 result.append(formatter.table_cell(0))
735 if kw['show_tools'] == '1':
736 result.append(formatter.table_row(0))
737 if n > 1 and cols > 1:
738 result.append('</table>')
739 if z != cols and i < n-1:
740 result.append(formatter.table_cell(1))
741 if z == cols and i != n-1:
742 result.append(formatter.table_cell(0))
743 result.append(formatter.table_row(0))
744 z += 1
745 i += 1
746 if z > cols:
747 z = 1
748
749 result.append('</table>')
750
751
752 ##Output
753
754 self.request.write(''.join(result))
755 # return()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.