Attachment 'Gallery2-1.3.5-7.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-09: 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                                     
 267 
 268                                                                         
 269                                     
 270     
 271     
 272 
 273 """
 274 Dependencies = []
 275 from MoinMoin.action import AttachFile
 276 from MoinMoin import wikiutil, config
 277 from MoinMoin.Page import Page
 278 import os,string,re,Image,StringIO
 279 from MoinMoin.parser import EXIF
 280 
 281 from MoinMoin.parser import wiki
 282 
 283 #def ImageProcess(var):
 284 #    f=open('/tmp/workfile.txt', 'w')
 285 #    f.write(var)
 286 #    f.close()
 287 def get_files(kw,path,files,quotes,request):
 288     web=[]
 289     full=[]
 290     thumb=[]
 291     exif_date=[]
 292     img_type=[]
 293     description=[]
 294     
 295     
 296     dict={}
 297     n=len(quotes['image'])
 298     if (n > 0) :
 299         i=0
 300         for txt in quotes['image']:
 301             dict[txt]=quotes['alias'][i]
 302             i=i+1    
 303     
 304     for attfile in files:
 305         
 306         # only files not thumb or webnails
 307         
 308         if ((string.find(string.join(attfile,''),'thumbnail_') == -1) and (string.find(string.join(attfile,''),'webnail_') == -1)) :
 309             # only images
 310             if wikiutil.isPicture(attfile):
 311                 
 312                 if (len(dict) > 0):
 313                    if (dict.has_key(attfile) > 0): 
 314                       description.append(dict[attfile])
 315                       
 316                    else:
 317                       description.append(attfile)
 318                 else:
 319                     description.append(attfile)
 320                         
 321                 full.append(attfile)
 322                 
 323                 if (kw['image_for_webnail']=='1'):
 324                     webnail=attfile
 325                 else:
 326                     file, ext = os.path.splitext(attfile)
 327                     if (ext == '.gif') or (ext == '.png'):
 328                         img_type.append('PNG')
 329                         webnail='webnail_'+file+".png"
 330                         thumbfile='thumbnail_'+file+".png"
 331                     else:
 332                         img_type.append("JPEG")
 333                         webnail='webnail_'+file+".jpg"
 334                         thumbfile='thumbnail_'+file+".jpg"
 335   
 336                 infile=os.path.join(path,attfile)
 337                 if os.path.exists(infile):
 338                      web.append(webnail)
 339                      thumb.append(thumbfile)
 340                      
 341                 f=open(infile, 'rb')
 342                 tags=EXIF.process_file(f)
 343                 if tags.has_key('EXIF DateTimeOriginal'):
 344                    date=str(tags['EXIF DateTimeOriginal'])
 345                    date=string.replace(date,':','-',2)
 346                    exif_date.append(date)
 347                 else:
 348                    date='--'
 349                    exif_date.append(date)
 350                 f.close()
 351       
 352     return thumb,web,full,exif_date,img_type,description  
 353     
 354 def to_htmltext(text):        
 355     new_text=text
 356     new_text=string.split(new_text,' ')
 357     new_text=string.join(new_text,' ')
 358     return new_text
 359 
 360 def to_wikiname(request,formatter,text):
 361   ##taken from MiniPage
 362     out=StringIO.StringIO()
 363     request.redirect(out)
 364     wikiizer = wiki.Parser(text.strip(),request)
 365     wikiizer.format(formatter)
 366     naw=out.getvalue()
 367     request.redirect()
 368     del out
 369     
 370     return naw.strip()
 371     
 372         
 373 def get_quotes(self,formatter):
 374     quotes = self.raw.split('\n')
 375     quotes = [quote.strip() for quote in quotes]
 376     quotes = [quote[2:] for quote in quotes if quote.startswith('* ')]
 377 
 378     
 379     image=[]
 380     text=[]
 381     
 382     for line in quotes:
 383         im,na=line[1:-1].split(' ',1)
 384         
 385         text.append(na.strip())
 386         image.append(im.strip())
 387 
 388     result={}
 389     result['alias']=text
 390     result['image']=image
 391 
 392     return result
 393 
 394 
 395 
 396 class Parser:
 397         
 398     def __init__(self, raw, request, **kw):
 399         self.raw = raw
 400         self.request = request
 401         self.form = request.form
 402         self._ = request.getText
 403         self.kw = {}
 404         self.kw['sort_by_date']='0' # nor implemented at the moment
 405         self.kw['sort_by_name']='1' 
 406         self.kw['sort_by_alias']='0' 
 407         self.kw['template_itemlist']='0' 
 408         self.kw['reverse_sort']='0'
 409         self.kw['border_thick']='1'
 410         self.kw['columns']='4'
 411         self.kw['filter']='.'
 412         self.kw['mode']='1'
 413         self.kw['help']='0'
 414         self.kw['show_text']='1'
 415         self.kw['show_date']='1'
 416         self.kw['show_tools']='1'
 417         self.kw['only_items']='0'
 418         self.kw['image_for_webnail']='0'
 419         self.kw['renew']='0'
 420         self.kw['thumbnail_width']='128'
 421         self.kw['webnail_width']='640'
 422         self.kw['text_width']='140'
 423 
 424        
 425 
 426         for arg in kw.get('format_args','').split(','):
 427 
 428             if (arg.find('=') > -1):
 429                key=arg.split('=')
 430                self.kw[str(key[0])]=wikiutil.escape(string.join(key[1],''), quote=1)
 431 
 432         self.kw['width']=str((int(self.kw['thumbnail_width'])+int(self.kw['text_width'])))
 433 
 434 
 435     def format(self, formatter):
 436         
 437         kw=self.kw
 438         Dict = {}
 439         quotes=get_quotes(self,formatter)
 440 
 441         current_pagename=formatter.page.page_name
 442 
 443         attachment_path = AttachFile.getAttachDir(self.request,current_pagename,create=1)
 444  
 445         if (kw['help'] == '1'):
 446 
 447             self.request.write('<BR>')
 448             self.request.write('{{{<BR>')
 449             self.request.write('#!Gallery2 [columns=columns],[filter=filter],[mode=mode],<BR>')
 450             self.request.write('           [show_text=show_text],[show_date=show_date], [show_tools=show_tools],<BR>')
 451             self.request.write('           [sort_by_name=sort_by_name],[sort_by_date=sort_by_date],[sort_by_alias=sort_by_alias]<BR>')
 452             self.request.write('           [reverse_sort=reverse_sort],<BR>')
 453             self.request.write('           [only_items=only_items],[template_itemlist=template_itemlist],<BR>')
 454             self.request.write('           [thumbnail_width=thumbnail_width],[webnail_width=webnail_width],[text_width=text_width],<BR>')
 455             self.request.write('           [image_for_webnail=image_for_webnail],<BR>')
 456             self.request.write('           [border_thick=border_thick],[renew=renew],[help=help]<BR>')
 457             self.request.write(' * [image1.jpg alias]<BR>')
 458             self.request.write(' * [image2.jpg alias]<BR>')
 459             self.request.write('}}}<BR>')
 460             return    
 461         
 462         if (kw['only_items'] == '1'):
 463             all_files=quotes['image']
 464             
 465             if (kw['sort_by_alias'] == '1'):
 466                 new_ordered_files=[]
 467                 alias_text=quotes['alias']
 468                 
 469                 i=0
 470                 for attfile in all_files:
 471                     infile=os.path.join(attachment_path,attfile)
 472                     ft_file=str(os.path.getmtime(infile))+os.tmpnam()
 473                     Dict[alias_text[i]]=attfile
 474                     i=i+1
 475        
 476                 keys = Dict.keys()   
 477                 keys.sort()
 478                 for txt in keys:
 479                     new_ordered_files.append(Dict[txt])
 480                    
 481 
 482                 all_files=new_ordered_files
 483                 Dict.clear()
 484            
 485         else:
 486             all_files=os.listdir(attachment_path)
 487 
 488         result=[]
 489 
 490         for test in all_files:
 491            if re.match(kw['filter'], test):
 492               result.append(test)
 493 
 494         all_files=result
 495 
 496         if (len(all_files) == 0):
 497             self.request.write("<BR><BR><H1>No matching image file found!</H1>")
 498             return
 499 
 500         if ((kw['sort_by_name']=='1') and (kw['only_items'] == '0')): 
 501             all_files.sort()
 502           
 503         if (kw['sort_by_date']=='1'): 
 504            
 505            for attfile in all_files:
 506                infile=os.path.join(attachment_path,attfile)
 507                ft_file=str(os.path.getmtime(infile))+os.tmpnam()
 508                Dict[ft_file]=attfile
 509        
 510            file_mdate=[]
 511            keys = Dict.keys()
 512            keys.sort()
 513            for txt in keys:
 514                file_mdate.append(Dict[txt])
 515 
 516            all_files=file_mdate
 517            Dict.clear()
 518          
 519         if (kw['reverse_sort']=='1'): 
 520              all_files.reverse()   
 521 
 522  
 523         cells=[]
 524  
 525         cell_name=[]
 526         
 527         img=[]
 528       
 529         thumb,web,full,exif_date,imgtype,description = get_files(kw,attachment_path,all_files, quotes,self.request)
 530         
 531         if (kw['template_itemlist'] == '1'):
 532            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>')
 533        
 534         i=0
 535         for attfile in full :
 536             thumbfile=thumb[i]
 537 
 538             img_type=imgtype[i]
 539 
 540             infile=os.path.join(attachment_path,attfile)
 541             webnail=web[i]
 542             this_description=description[i]
 543             this_exif_date=exif_date[i]
 544            
 545             img.append(attfile)
 546             if (kw['template_itemlist'] == '1'):
 547                 self.request.write(' * [%(attfile)s %(date)s]<BR>' % {
 548                                    'attfile' : attfile,
 549                                    'date'    : 'alias'
 550                                     })
 551 
 552             thumbf=os.path.join(attachment_path,thumbfile)
 553             webf=os.path.join(attachment_path,webnail)
 554 
 555             if (kw['renew'] == '1'):
 556                 if os.path.exists(thumbf):
 557                    os.unlink(thumbf)
 558                 if os.path.exists(webf):
 559                    os.unlink(webf)
 560 
 561             
 562             if (not os.path.exists(webf) or not os.path.exists(thumbf)):
 563                 im = Image.open(infile)
 564                 if not os.path.exists(webf):
 565                     im.thumbnail(((int(kw['webnail_width'])),((int(kw['webnail_width'])))), Image.ANTIALIAS)
 566                     im.save(webf, img_type)
 567                 if not os.path.exists(thumbf):
 568                     im.thumbnail(((int(kw['thumbnail_width'])),((int(kw['thumbnail_width'])))),
 569                                    Image.ANTIALIAS)
 570                     im.save(thumbf, img_type)
 571             
 572            
 573            
 574             
 575             alias_text="%(this)s,%(all_other)s" % {
 576                       "this":this_description,
 577                       "all_other":string.join(description,'","')}
 578             
 579             text='<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data"><TT>' % {
 580                   'baseurl': self.request.getScriptname(),
 581                   'pagename': wikiutil.quoteWikinameURL(current_pagename)}
 582                   
 583             
 584             text=text+'<input type="hidden" name="action" value="gallery2image">'
 585             text=text+'<input type="hidden" name="do" value="VS">'
 586             text=text+'<input type="hidden" name="full" value="'+attfile+","+string.join(full,',')+'">'
 587             text=text+'<input type="hidden" name="alias" value="'+to_htmltext(this_description+"!,!"+string.join(description,'!,!'))+'">'
 588             text=text+'<input type="hidden" name="exif_date" value="'+to_htmltext(this_exif_date+","+string.join(exif_date,','))+'">'
 589             
 590             text=text+'<input type="hidden" name="target" value="'+webnail+","+string.join(web,',')+'">'
 591             
 592             text=text+'<input type="image" value="submit" src='+AttachFile.getAttachUrl(current_pagename,thumbfile,self.request)+'>'
 593             text=text+'</FORM>'
 594                         
 595             cells.append(text)
 596             cell_name.append(attfile)
 597             i=i+1
 598 
 599 
 600 
 601        
 602         result=[]
 603         if (len(full) == 0):
 604            result.append('Image not found')
 605            
 606            
 607            
 608 
 609         #if (valid_img > 1):
 610         
 611         
 612         n=len(cells)
 613         cols=int(kw['columns'])
 614         rows=n/cols
 615         first=0
 616         z=1
 617         i=0
 618 
 619         ############################################
 620         ##TODO: syntax change to formatter - later #
 621         ############################################
 622 
 623         # fixed width because of better visualisation on different browsers
 624         
 625         result.append('<table border="'+kw['border_thick']+'" valign="bottom">')
 626         l=0
 627         for line in cells:
 628             if (z == 1):
 629                if (cols > 1) and (n > 1):
 630                   if (kw['mode']=='1'):
 631                      result.append('<td width="'+kw['thumbnail_width']+'" >')
 632                      #result.append(formatter.table_cell(1))
 633                   else:
 634                       result.append('<td width="'+kw['width']+'" >')
 635             if n > 1 and cols > 1:
 636                result.append('<table border="1" valign="center">')
 637 
 638             result.append('<TR valign="center">')
 639             # image align center
 640             result.append('<td align="center" valign="center" width="'+kw['thumbnail_width']+'">')
 641             result.append(line)
 642             result.append(formatter.table_cell(0))
 643 
 644             if (kw['show_text']=='1'):
 645                 if (kw['mode']=='1'):
 646                   result.append(formatter.table_row(0))
 647                   result.append(formatter.table_row(1))
 648                   # text aligned left in mode 1
 649                   result.append('<td align="left" width="'+kw['thumbnail_width']+'" >')
 650                 else:
 651                      # text aligned on top in mode 2
 652                     result.append('<td valign="top" width="'+kw['text_width']+'" >')
 653 
 654                
 655 
 656                 result.append(to_wikiname(self.request,formatter,description[l]))
 657                 
 658                 result.append(formatter.table_cell(0))
 659                 if (kw['mode']=='1'):
 660                     result.append(formatter.table_row(0))
 661                 l=l+1
 662 
 663 
 664             if (kw['show_date']=='1'):
 665                 if (kw['mode']=='1'):
 666                     result.append(formatter.table_row(1))
 667                     result.append(formatter.table_cell(1))
 668                     result.append(exif_date[i])
 669                     result.append(formatter.table_cell(0))
 670                     result.append(formatter.table_row(0))
 671 
 672             if (kw['show_tools'] == '1'):
 673                result.append(formatter.table_row(1))
 674                # tool bar centriert
 675                result.append('<td align="center">')
 676                result.append('<TABLE align="center">')
 677                result.append('<TR><td>')
 678                result.append('<FORM><TT>')
 679 
 680                result.append('<input type="hidden" name="action" value="AttachFile">')
 681                result.append('<input type="hidden" name="do" value=get>')
 682                result.append('<input type="hidden" name="target" value="'+img[i]+'">')
 683                result.append('<input type="image" value="submit" src="/wiki/modern/img/to_full.png" title="load image">')
 684                result.append('</TT></FONT></FORM>')
 685                result.append('</td><td>')
 686                result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data"><TT>' % {
 687                              'baseurl': self.request.getScriptname(),
 688                              'pagename': wikiutil.quoteWikinameURL(current_pagename)})
 689 
 690                result.append('<input type="hidden" name="action" value="gallery2image">')
 691                result.append('<input type="hidden" name="do" value="VS">')
 692                result.append('<input type="hidden" name="full" value="'+attfile+","+string.join(full,',')+'">')
 693                result.append('<input type="hidden" name="alias" value="'+to_htmltext(description[0]+"!,!"+string.join(description,'!,!'))+'">')
 694                
 695                result.append('<input type="hidden" name="target" value="'+webnail+","+string.join(web,',')+'">')
 696                result.append('<input type="hidden" name="exif_date" value="'+to_htmltext(this_exif_date+","+string.join(exif_date,','))+'">')
 697                #result.append('<input type="hidden" name="target" value='+string.join(img,',')+'>')
 698                result.append('<input type="image" value="submit" src="/wiki/modern/img/to_slide.png" title="slide_show">')
 699                result.append('</TT></FONT></FORM>')
 700                result.append('</td>')
 701 
 702                if self.request.user.may.delete(current_pagename):
 703                    result.append('<td>')
 704 
 705                    result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data"><TT>' % {
 706                                  'baseurl': self.request.getScriptname(),
 707                                  'pagename': wikiutil.quoteWikinameURL(current_pagename)})
 708 
 709                    result.append('<input type="hidden" name="action" value="gallery2image">')
 710                    result.append('<input type="hidden" name="do" value="RL">')
 711                    result.append('<input type="hidden" name="target" value="'+img[i]+'">')
 712                    result.append('<input type="image" value="submit" src="/wiki/modern/img/to_left.png" title="rotate to left">')
 713                    result.append('</TT></FONT></FORM>')
 714                    result.append('</td><td>')
 715                    result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data"><TT>' % {
 716                                 'baseurl': self.request.getScriptname(),
 717                                 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
 718 
 719                    result.append('<input type="hidden" name="action" value="gallery2image">')
 720                    result.append('<input type="hidden" name="do" value="RR">')
 721                    result.append('<input type="hidden" name="target" value="'+img[i]+'">')
 722                    result.append('<input type="image"  value="submit" src="/wiki/modern/img/to_right.png" title="rotate to right">')
 723 
 724                    result.append('</TT></FONT></FORM>')
 725                    result.append('</td><td>')
 726                    result.append('<form action="%(baseurl)s/%(pagename)s" method="POST" enctype="multipart/form-data"><TT>' % {
 727                                 'baseurl': self.request.getScriptname(),
 728                                 'pagename': wikiutil.quoteWikinameURL(current_pagename)})
 729 
 730                    result.append('<input type="hidden" name="action" value="gallery2image">')
 731                    result.append('<input type="hidden" name="do" value="RM">')
 732                    result.append('<input type="hidden" name="target" value="'+img[i]+'">')
 733                    result.append('<input type="image" value="submit" src="/wiki/modern/img/to_bak.png" title="move to bak">')
 734                    result.append('</TT></FONT></FORM>')
 735                    result.append('</TD>')
 736                result.append('</TR>')
 737                result.append('</TABLE>')
 738 
 739             result.append(formatter.table_cell(0))
 740             if (kw['show_date']=='1'):
 741                 if not (kw['mode']=='1'):
 742                     result.append(formatter.table_cell(1))
 743                     result.append(exif_date[i])
 744                     result.append(formatter.table_cell(0))
 745             if (kw['show_tools'] == '1'):
 746                result.append(formatter.table_row(0))
 747             if n > 1 and cols > 1:
 748                result.append(formatter.table(0))
 749             if ((z != cols) and (i < n-1)):
 750                 result.append(formatter.table_cell(1))
 751             if (z == cols):
 752                 result.append(formatter.table_cell(0))
 753                 result.append(formatter.table_row(0))
 754             z=z+1
 755             i=i+1
 756             if (z > cols):
 757                z=1
 758 
 759         result.append(formatter.table(0))
 760         ##Output
 761         self.request.write(string.join(result,''))
 762         
 763         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.
  • [get | view] (2006-08-06 08:57:54, 41.8 KB) [[attachment:EXIF.py]]
  • [get | view] (2005-03-24 20:14:37, 10.6 KB) [[attachment:Gallery2-1.3.3-1.py]]
  • [get | view] (2005-03-26 08:39:13, 11.6 KB) [[attachment:Gallery2-1.3.3-2.py]]
  • [get | view] (2005-03-26 12:41:49, 13.1 KB) [[attachment:Gallery2-1.3.3-3.py]]
  • [get | view] (2005-03-27 20:23:01, 19.0 KB) [[attachment:Gallery2-1.3.3-4.py]]
  • [get | view] (2005-08-03 19:30:10, 23.2 KB) [[attachment:Gallery2-1.3.3-5.py]]
  • [get | view] (2005-08-18 07:58:38, 31.9 KB) [[attachment:Gallery2-1.3.5-10.py]]
  • [get | view] (2005-09-02 19:55:13, 34.1 KB) [[attachment:Gallery2-1.3.5-11.py]]
  • [get | view] (2005-11-13 18:09:11, 35.4 KB) [[attachment:Gallery2-1.3.5-12.py]]
  • [get | view] (2005-11-18 20:13:04, 46.2 KB) [[attachment:Gallery2-1.3.5-13.py]]
  • [get | view] (2005-12-03 15:33:06, 46.6 KB) [[attachment:Gallery2-1.3.5-14.py]]
  • [get | view] (2006-01-01 09:20:19, 43.3 KB) [[attachment:Gallery2-1.3.5-15.py]]
  • [get | view] (2005-08-07 15:46:28, 26.9 KB) [[attachment:Gallery2-1.3.5-6.py]]
  • [get | view] (2005-08-13 15:13:59, 28.7 KB) [[attachment:Gallery2-1.3.5-7.py]]
  • [get | view] (2005-08-14 13:02:00, 27.5 KB) [[attachment:Gallery2-1.3.5-8.py]]
  • [get | view] (2005-08-14 14:38:32, 28.7 KB) [[attachment:Gallery2-1.3.5-9.py]]
  • [get | view] (2006-08-06 08:45:47, 41.8 KB) [[attachment:Gallery2-1.5.4-16.py]]
  • [get | view] (2006-08-22 20:29:39, 42.0 KB) [[attachment:Gallery2-1.5.4-18.py]]
  • [get | view] (2006-08-06 08:57:36, 514.8 KB) [[attachment:example.swf]]
  • [get | view] (2005-08-17 18:10:27, 11.3 KB) [[attachment:gallery2image_test.py]]
  • [get | view] (2005-08-10 16:49:16, 1.3 KB) [[attachment:patchpullfromdir.diff]]
  • [get | view] (2006-08-17 16:32:50, 41.9 KB) [[attachment:text_x_gallery2-1.6.0-17.py]]
  • [get | view] (2006-08-22 20:23:06, 42.1 KB) [[attachment:text_x_gallery2-1.6.0-18.py]]
  • [get | view] (2008-02-06 10:08:05, 42.2 KB) [[attachment:text_x_gallery2-1.6.0-19.py]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.