Attachment 'Rollover.py'

Download

   1 #####################################################################################################
   2 #Rollover macro for moinmoin
   3 #
   4 #Developer: Carlos Zager
   5 #Email:czager@corvus.com.ve
   6 #Date:Mon May 12 13:25:44 VET 2008
   7 #Revision:0.1
   8 #
   9 #This macro is intended to be used as a way to attach an image reference with a rollover to a page
  10 #
  11 #Syntax: [[Rollover(url1,url2,width,height,link)]]
  12 #
  13 #@url1:URL of the base image to be used
  14 #@url2:URL of the roll image to be used
  15 #@width:Width of the biggest image
  16 #@height:Height of the biggest image
  17 #@link:URL where the  rollover should point to
  18 #####################################################################################################
  19 
  20 import random,os
  21 
  22 def execute(macro,args):
  23 	args=args.split(',')
  24 	orig=args[0]
  25 	origp=os.path.dirname(orig)
  26 	origi=os.path.basename(orig)
  27 	roll=args[1]
  28 	rollp=os.path.dirname(roll)
  29 	rolli=os.path.basename(roll)
  30 	width=args[2]
  31 	height=args[3]
  32 	link=args[4]
  33 	n=random.randint(0,10000)
  34 	name='img%d'%n
  35 	return macro.formatter.rawHTML("<style type='text/css'>.%s{display:block;width:%spx;height:%spx;background:url(%s?action=AttachFile&do=get&target=%s) no-repeat;} .%s:hover{background:url(%s?action=AttachFile&do=get&target=%s) no-repeat;}</style><a href='%s' class='%s'></a>"%(name,width,height,origp,origi,name,rollp,rolli,link,name))

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] (2008-05-12 17:35:10, 1.3 KB) [[attachment:Rollover.py]]
 All files | Selected Files: delete move to page copy to page

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