ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/rootEWKanalyzer/makeWebpage.py
Revision: 1.1
Committed: Mon Jun 7 14:57:40 2010 UTC (14 years, 10 months ago) by jueugste
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Error occurred while calculating annotation data.
Log Message:
first commit

File Contents

# Content
1 #!/usr/bin/python
2
3 ## This script writes an index.html page
4 ## displaying all plots contained in the
5 ## directory.
6 ##
7 ## The file: makeWebpage.html is needed
8 ## to be kept in the same place as the
9 ## script and is used as a template.
10 ## -------------------------------------
11 ## Usage: ./makeWebpage.py DIR
12 ## -------------------------------------
13 ## with DIR = the path to the directoy
14 ## containig the plots.
15 ## DIR will also be the title of the
16 ## webpage.
17 ##
18 ## For the moment it works for .gif's.
19 ## For other formats, change line 42
20 ## accordingly.
21 ##
22 ## After running the script, copy the
23 ## folder conatining the plots and the
24 ## index.html to an apropriate place.
25 ## (This can be autmated too, if needed.)
26
27
28
29
30
31 import sys
32 import os
33 import re
34
35 directory=sys.argv[1]
36
37 # get the plots in the directory
38 list = os.listdir(directory)
39 list.sort()
40 # open a tmeplate file and the new .html file
41 template=open("makeWebpage.html","r")
42 page=open(directory+"/index.html","w")
43
44 # write the common part of the index.html
45 for line in template:
46 if(re.search(r'blablabla',line)!=None):
47 page.write(sys.argv[1])
48 else:
49 page.write(line)
50
51 page.write('<strong>'+sys.argv[1]+' </strong><br>')
52
53 # add all the plots in the directory
54 for i in range(len(list)):
55 if(re.search(r'gif',list[i])!=None):
56 print list[i]
57 page.write('<a href=" '+list[i])
58 page.write('" onMouseOver="ThumbnailPlot(')
59 page.write("'"+list[i]+"'), ClearNotes(), ThumbnailNote() ")
60 page.write('"> <img src="'+list[i]+' " style="height:22px; width:25px;"><small>'+list[i]+' </small></a> <br> \n')
61
62 # write the last lines
63 page.write('<br>\n')
64 page.write('<div id="thumb_gen"><a href="#" id="thumblink_l"><img src="" id="thumb_l" width=0 height=0 border=0></a></div> \n')
65 page.write('</body> \n')
66 page.write(' </html>\n')
67
68
69 # now copy everything on the wwweth server...
70 #os.system("scp -r "+directory+" wwweth.cern.ch:JetMETPromptAnalysis/")
71
72
73
74
75
76
77
78
79
80
81
82