Changeset 3213
- Timestamp:
- 2007-08-30 04:53:07 (1 year ago)
- Files:
-
- arkaiv/trunk/TODO (modified) (1 diff)
- arkaiv/trunk/arkaiv/controllers/page.py (modified) (9 diffs)
- arkaiv/trunk/arkaiv/controllers/page.pyc (modified) (previous)
- arkaiv/trunk/arkaiv/model/cmmlparser.py (modified) (3 diffs)
- arkaiv/trunk/arkaiv/model/cmmlparser.pyc (modified) (previous)
- arkaiv/trunk/arkaiv/public/quick.css (modified) (2 diffs)
- arkaiv/trunk/arkaiv/templates/autohandler (modified) (1 diff)
- arkaiv/trunk/arkaiv/templates/displayitem.mak (modified) (2 diffs)
- arkaiv/trunk/data/templates/autohandler.py (modified) (3 diffs)
- arkaiv/trunk/data/templates/autohandler.pyc (modified) (previous)
- arkaiv/trunk/data/templates/displayitem.mak.py (modified) (3 diffs)
- arkaiv/trunk/data/templates/displayitem.mak.pyc (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
arkaiv/trunk/TODO
r3210 r3213 1 1 TODO 2 3 Handle whitespace in a source file name - doesn't do this at all at the moment 2 4 3 5 When going to an item from a clip link on the search results page, any arkaiv/trunk/arkaiv/controllers/page.py
r3210 r3213 229 229 # create an image to display for the clip 230 230 if has_video == "Yes": 231 basename = os.path.splitext(cmmlfile)[0] 232 imagedirname = basename + "_clipimages" 233 clipimagename = str(clip['starttime']) + ".png" 234 oggsource = model.getsourcepath(clip['itemid']) 235 cwd = os.getcwd() 236 os.chdir(imagedirname) # ugly... 237 frameimage = Frame(oggsource, clip['starttime'], clipimagename) 238 os.chdir(cwd) # very ugly... # 239 240 # add that info to the dictionary - only needs to be a relative 241 # location 242 243 relpath = os.path.split(imagedirname)[1] 244 clip['img_src'] = relpath + "/" + clipimagename 231 clip['img_src'] = self.__createimageforclip(cmmlfile, clip) 232 # basename = os.path.splitext(cmmlfile)[0] 233 # imagedirname = basename + "_clipimages" 234 # clipimagename = str(clip['starttime']) + ".png" 235 # oggsource = model.getsourcepath(clip['itemid']) 236 # cwd = os.getcwd() 237 # os.chdir(imagedirname) # ugly... 238 # frameimage = Frame(oggsource, clip['starttime'], clipimagename) 239 # os.chdir(cwd) # very ugly... # 240 # 241 # # add that info to the dictionary - only needs to be a relative 242 # # location 243 # 244 # relpath = os.path.split(imagedirname)[1] 245 # clip['img_src'] = relpath + "/" + clipimagename 246 245 247 else: 246 248 clip['img_src'] = "" … … 285 287 if cmmlsource=="": 286 288 print "creating source file" 287 basecmmlname = os.path.splitext(oggsource.filename)[0] + ".cmml"289 basecmmlname = os.path.splitext(oggsource.filename)[0].replace(' ',"") + ".cmml" 288 290 newcmmlname = os.path.join(archive_loc, basecmmlname) 289 291 parser = cmmlParser() … … 293 295 294 296 else: 295 newcmmlname = os.path.join(archive_loc, cmmlsource.filename )297 newcmmlname = os.path.join(archive_loc, cmmlsource.filename.replace(' ',"")) 296 298 permanent_file = open(newcmmlname, 'w') 297 299 shutil.copyfileobj(cmmlsource.file, permanent_file) … … 300 302 301 303 # Now the ogg file... 302 newoggname = os.path.join(archive_loc, oggsource.filename) 304 # FIXME whitespace is dealt with in a very clumsy manner 305 newoggname = os.path.join(archive_loc, oggsource.filename.replace(' ', "")) 303 306 permanent_file = open(newoggname, 'w') 304 307 shutil.copyfileobj(oggsource.file, permanent_file) … … 313 316 os.makedirs(imagedirname, mode=0755) 314 317 315 # cmd = "mplayer -vo png:z=6 -vf scale -zoom -xy 96 -ao null -ss '1000' -frames 2 " + newoggname316 # cwd = os.getcwd()317 # os.chdir(imagedirname)318 #319 # runit = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE320 #, stderr=subprocess.PIPE)321 # out, err = runit.communicate()322 # os.chdir(cwd) # very ugly... better image creation needed allround really.323 318 324 319 # Get the title for the item (head title) … … 346 341 # Now extract any clip information and add it to the database 347 342 # get a list of dictionary objects 348 cliplist = parser.getclipsfromcmml(newcmmlname) 343 344 o = OggzInfo(newoggname) 345 cliplist = parser.getclipsfromcmml() 349 346 for clipdict in cliplist: 350 347 clipdict['itemid'] = newitemid 348 if o.has_video(): 349 # get a still image for the correct frame 350 print "getting a clip image" 351 #clipdict['img_src'] = "" 352 clipdict['img_src'] = self.__createimageforclip(newcmmlname, clipdict) 353 else: 354 clipdict['img_src'] = "" 351 355 model.addclip(clipdict) 352 356 … … 422 426 files = os.listdir(directory) 423 427 for file in files: 424 if os.path.splitext(file)[1] == ".cmml": 425 oggfilename = directory + os.path.splitext(file)[0] + ".ogg" 426 cmmlfilename = directory + file 427 print "importing: " + cmmlfilename + " " + oggfilename 428 self.__localdirimport(cmmlfilename, oggfilename) 429 else: 430 print "moving right past: " + file 431 428 try: 429 if os.path.splitext(file)[1] == ".cmml": 430 oggfilename = directory + os.path.splitext(file)[0] + ".ogg" 431 cmmlfilename = directory + file 432 print "importing: " + cmmlfilename + " " + oggfilename 433 self.__localdirimport(cmmlfilename, oggfilename) 434 else: 435 print "moving right past: " + file 436 except: 437 print " problem with " + file 432 438 return 433 439 … … 469 475 # Now extract any clip information and add it to the database 470 476 # get a list of dictionary objects 471 cliplist = parser.getclipsfromcmml( newcmmlname)477 cliplist = parser.getclipsfromcmml() 472 478 for clipdict in cliplist: 473 479 clipdict['itemid'] = newitemid … … 498 504 return 499 505 500 506 def __createimageforclip(self, cmmlfile, clipinfo): 507 # print "cmmlfile: " + cmmlfile 508 # print clipinfo 509 basename = os.path.splitext(cmmlfile)[0] 510 # print basename 511 imagedirname = basename + "_clipimages" 512 clipimagename = str(clipinfo['starttime']) + ".png" 513 # print "clip name: " + clipimagename 514 oggsource = model.getsourcepath(clipinfo['itemid']) 515 # print oggsource 516 cwd = os.getcwd() 517 # print cwd 518 os.chdir(imagedirname) # ugly... 519 frameimage = Frame(oggsource, int(clipinfo['starttime']), clipimagename) 520 print "after frameimage" 521 os.chdir(cwd) # very ugly... # 522 523 # add that info to the dictionary - only needs to be a relative 524 # location 525 relpath = os.path.split(imagedirname)[1] 526 imagefile = relpath + "/" + clipimagename 527 # print imagefile 528 return imagefile 529 arkaiv/trunk/arkaiv/model/cmmlparser.py
r3209 r3213 88 88 return title 89 89 90 def getclipsfromcmml(self , cmmlfilename):91 Etree = ElementTree92 doc = Etree.parse(cmmlfilename) 93 root = doc.getroot()94 clips = root.getiterator('clip')90 def getclipsfromcmml(self): 91 """ returns a dictionary of clips from the object's cmmlfile 92 93 """ 94 clips = self.root.getiterator('clip') 95 95 cliplist = [] 96 96 for clip in clips: … … 100 100 desc = clip.find('desc') 101 101 clipdict['desc'] = desc.text 102 clipdict['a_href'] = None 103 clipdict['a_text'] = None 104 clipdict['img_src'] = None 102 clipdict['a_href'] = None # FIXME 103 clipdict['a_text'] = None # FIXME 104 clipdict['img_src'] = None # FIXME 105 105 106 106 cliplist.append(clipdict) … … 143 143 newclip.set('id', clip['id']) 144 144 img = Etree.SubElement(newclip, 'img') 145 img.set('src', clip['img_src'])145 img.set('src', str(clip['img_src'])) 146 146 desc = Etree.SubElement(newclip, 'desc') 147 147 desc.text = clip['desc'] arkaiv/trunk/arkaiv/public/quick.css
r3208 r3213 1 1 body { 2 font-family: sans-serif; 3 background-color: #888; 2 font-family: Helvetica, Verdana, Arial, sans-serif; 3 font-size: small; 4 background-color: #efefef; 4 5 margin: 25px; 5 6 } 7 a:link{ 8 color: #369; 9 } 10 a:visited{ 11 color: #00f; 12 } 13 a:hover{ 14 color: #000; 15 } 16 a:active{ 17 color: #666; 18 } 19 20 6 21 div.content{ 7 22 font-family: sans-serif; 8 23 margin: 0; 9 24 margin-bottom: 10px; 10 background-color: # d3e0ea;25 background-color: #ccc; /*#d3e0ea */ 11 26 border: 5px solid #333; 12 padding: 5px 25px 25px 25px; 27 /* padding: 5px 25px 25px 25px;*/ 13 28 } 14 29 #video{ 15 30 float: left; 16 width: 60%; 17 background-color: #d3e0ea; 31 width: 50%; 32 /* max-width: 350px*/ 33 background-color: #ccc; 18 34 font-family: sans-serif; 19 font-size: small 35 font-size: small; 36 /*padding: 10px 20px 10px 40px;*/ 37 padding-left: 10px; 20 38 } 21 39 #clips{ 22 40 float: left; 23 width: 4 0%;41 width: 45%; 24 42 height: 500px; 25 43 overflow: scroll; 26 44 font-family: sans-serif; 27 45 font-size: small 46 padding-left: 10px; 28 47 } 29 48 … … 31 50 font-size: small 32 51 } 52 33 53 h1.main{ 34 54 width: 100%; 35 55 border-bottom: 1px solid #000; 36 56 } 57 37 58 p.footer{ 38 59 width: 100%; 39 60 padding-top: 3px; 40 border-top: 1px solid #000;61 /*border-top: 1px solid #000;*/ 41 62 } 42 63 64 #navcontainer ul { 65 padding-left: 0; 66 margin-left: 0; 67 background-color: #036; 68 color: #fff; 69 float: left; 70 /*height: 40px;*/ 71 font-size: 18px; 72 width: 100%; 73 font-family: Helvetica, Verdana, Arial, sans-serif; 74 } 75 76 #navcontainer ul li { display: inline; } 77 78 #navcontainer ul li a { 79 padding: 0.7em 1em; 80 /* padding: 11px 15px; */ 81 background-color: #036; 82 color: #fff; 83 text-decoration: none; 84 float: left; 85 border-right: 1px solid #fff; 86 } 87 88 #navcontainer ul li .searchpadding { 89 /* padding: 0.6em 1em;*/ 90 padding: 10px 15px 11px 15px; 91 background-color: #036; 92 color: #fff; 93 text-decoration: none; 94 float: left; 95 border-right: 1px solid #fff; 96 } 97 98 #navcontainer ul li a:hover { 99 background-color: #369; 100 color: #fff; 101 } 102 103 #navcontainer ul li a:active { 104 background-color: #fb0; 105 color: #fff; 106 } 107 arkaiv/trunk/arkaiv/templates/autohandler
r3208 r3213 7 7 </head> 8 8 <body> 9 <p class="header">9 <p class="header"> 10 10 <h1>Arkaiv</h1> 11 < table cellpadding="10">12 < tr>13 <td>${ h.link_to("All Items", h.url(action="mainpage")) } </td>14 <td>${ h.link_to("Collections", h.url(action="collections")) } </td>15 <td>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</td>16 <td>17 ${ h.form(h.url(action='search'), multipart=True) } 11 <div id="navcontainer"> 12 <ul id="navlist"> 13 <li>${ h.link_to("All Items", h.url(action="mainpage")) }</li> 14 <li>${ h.link_to("Collections", h.url(action="collections")) }</li> 15 <li>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</li> 16 <li><span class="searchpadding"> 17 ${ h.form(h.url(action='search'), multipart=True) } 18 18 ${ h.text_field('searchterms', value="Search") } 19 19 <!--${ h.submit('Submit') }--> 20 20 ${ h.end_form() } 21 </td> 22 </tr> 23 </table> 24 </p> 21 </span> 22 </li> 23 </ul> 24 </div> 25 </p> 26 25 27 <!--div class="content"--> 26 28 ${next.body()} arkaiv/trunk/arkaiv/templates/displayitem.mak
r3210 r3213 138 138 <tr> 139 139 <td></td> 140 <td>Start time</td> 141 <td>Id</td> 142 <td>Description</td> 143 <td>a_href</td> 140 <td>Time</td> 141 <td></td> 142 <td></td> 144 143 </tr> 145 144 % for clipinfo in c.cliplist: … … 149 148 % endif 150 149 % if c.sourcedict['has_video'] == "No": 151 <td><a onclick="javascript:SetLocation('${c.sourcedict['urlpath']}?id=${clipinfo['id']}')"><img src="/ public/blank.png"></a></td>150 <td><a onclick="javascript:SetLocation('${c.sourcedict['urlpath']}?id=${clipinfo['id']}')"><img src="/images/blank.png"></a></td> 152 151 % endif 153 152 <td>${clipinfo['start_time']}</td> 154 <td>${clipinfo['id']}</td>155 153 <td>${clipinfo['desc']}</td> 156 154 <td>${clipinfo['a_href']}</td> arkaiv/trunk/data/templates/autohandler.py
r3208 r3213 2 2 UNDEFINED = runtime.UNDEFINED 3 3 _magic_number = 2 4 _modified_time = 1188 364190.68148494 _modified_time = 1188463289.27105 5 5 _template_filename=u'/home/dcrowdy/src/working/test/arkaiv/trunk/arkaiv/templates/autohandler' 6 6 _template_uri=u'/autohandler' … … 20 20 # SOURCE LINE 5 21 21 context.write(unicode( h.javascript_include_tag('/javascripts/effects.js', builtins=True) )) 22 context.write(u' \n\n </head>\n <body>\n <p class="header">\n<h1>Arkaiv</h1>\n<table cellpadding="10">\n<tr>\n<td>')22 context.write(u' \n\n </head>\n <body>\n<p class="header">\n<h1>Arkaiv</h1>\n<div id="navcontainer">\n<ul id="navlist">\n <li>') 23 23 # SOURCE LINE 13 24 24 context.write(unicode( h.link_to("All Items", h.url(action="mainpage")) )) 25 context.write(u' </td>\n<td>')25 context.write(u'</li>\n <li>') 26 26 # SOURCE LINE 14 27 27 context.write(unicode( h.link_to("Collections", h.url(action="collections")) )) 28 context.write(u' </td>\n<td>')28 context.write(u'</li>\n <li>') 29 29 # SOURCE LINE 15 30 30 context.write(unicode( h.link_to("Add annodex media", h.url(action="addannodexform")) )) 31 context.write(u'</ td>\n<td>\n')31 context.write(u'</li>\n <li><span class="searchpadding">\n') 32 32 # SOURCE LINE 17 33 33 context.write(unicode( h.form(h.url(action='search'), multipart=True) )) 34 context.write(u' \n')34 context.write(u'\n') 35 35 # SOURCE LINE 18 36 36 context.write(unicode( h.text_field('searchterms', value="Search") )) … … 41 41 # SOURCE LINE 20 42 42 context.write(unicode( h.end_form() )) 43 context.write(u' \n </td>\n</tr>\n</table>\n </p>\n <!--div class="content"-->\n')44 # SOURCE LINE 2 643 context.write(u' \n </span>\n </li>\n</ul>\n</div>\n</p>\n\n <!--div class="content"-->\n') 44 # SOURCE LINE 28 45 45 context.write(unicode(next.body())) 46 46 context.write(u'\n <p class="footer">\n </p>\n <!--/div-->\n </body>\n</html>\n\n') arkaiv/trunk/data/templates/displayitem.mak.py
r3210 r3213 2 2 UNDEFINED = runtime.UNDEFINED 3 3 _magic_number = 2 4 _modified_time = 118843 0842.5310394 _modified_time = 1188439839.8722601 5 5 _template_filename='/home/dcrowdy/src/working/test/arkaiv/trunk/arkaiv/templates/displayitem.mak' 6 6 _template_uri='/displayitem.mak' … … 137 137 # SOURCE LINE 127 138 138 context.write(unicode(c.sourcedict['has_audio'])) 139 context.write(u'</td>\n</tr>\n</table>\n\n<!--/div!-->\n</div>\n\n<div id="clips">\nClips:\n<br />\n<table style="font-size:small">\n<tr>\n <td></td>\n <td> Start time</td>\n <td>Id</td>\n <td>Description</td>\n <td>a_href</td> \n</tr>\n')140 # SOURCE LINE 14 5139 context.write(u'</td>\n</tr>\n</table>\n\n<!--/div!-->\n</div>\n\n<div id="clips">\nClips:\n<br />\n<table style="font-size:small">\n<tr>\n <td></td>\n <td>Time</td>\n <td></td>\n <td></td> \n</tr>\n') 140 # SOURCE LINE 144 141 141 for clipinfo in c.cliplist: 142 # SOURCE LINE 145 143 context.write(u'<tr>\n') 142 144 # SOURCE LINE 146 143 context.write(u'<tr>\n')144 # SOURCE LINE 147145 145 if c.sourcedict['has_video'] == "Yes": 146 # SOURCE LINE 14 8146 # SOURCE LINE 147 147 147 context.write(u' <td><a onclick="javascript:SetLocation(\'') 148 148 context.write(unicode(c.sourcedict['urlpath'])) … … 153 153 context.write(unicode(clipinfo['img_src'])) 154 154 context.write(u'"></a></td>\n') 155 # SOURCE LINE 1 50155 # SOURCE LINE 149 156 156 if c.sourcedict['has_video'] == "No": 157 # SOURCE LINE 15 1157 # SOURCE LINE 150 158 158 context.write(u' <td><a onclick="javascript:SetLocation(\'') 159 159 context.write(unicode(c.sourcedict['urlpath'])) 160 160 context.write(u'?id=') 161 161 context.write(unicode(clipinfo['id'])) 162 context.write(u'\')"><img src="/ public/blank.png"></a></td>\n')163 # SOURCE LINE 15 3162 context.write(u'\')"><img src="/images/blank.png"></a></td>\n') 163 # SOURCE LINE 152 164 164 context.write(u' <td>') 165 165 context.write(unicode(clipinfo['start_time'])) 166 166 context.write(u'</td>\n <td>') 167 # SOURCE LINE 154 168 context.write(unicode(clipinfo['id'])) 169 context.write(u'</td>\n <td>') 170 # SOURCE LINE 155 167 # SOURCE LINE 153 171 168 context.write(unicode(clipinfo['desc'])) 172 169 context.write(u'</td>\n <td>') 173 # SOURCE LINE 15 6170 # SOURCE LINE 154 174 171 context.write(unicode(clipinfo['a_href'])) 175 172 context.write(u'</td>\n\n\n') 176 # SOURCE LINE 15 9173 # SOURCE LINE 157 177 174 context.write(unicode( h.form(h.url(action='deleteclip'), multipart=True) )) 178 175 context.write(u'\n<td>') 179 # SOURCE LINE 1 60176 # SOURCE LINE 158 180 177 context.write(unicode( h.submit('Delete') )) 181 178 context.write(u' </td>\n') 182 # SOURCE LINE 1 61179 # SOURCE LINE 159 183 180 context.write(unicode( h.hidden_field('clipid', value=clipinfo['ixc']) )) 184 181 context.write(u'\n') 185 # SOURCE LINE 16 2182 # SOURCE LINE 160 186 183 context.write(unicode( h.hidden_field('itemid', value=c.itemid) )) 187 184 context.write(u'\n') 188 # SOURCE LINE 16 3185 # SOURCE LINE 161 189 186 context.write(unicode( h.end_form() )) 190 187 context.write(u' \n\n\n</tr> \n') 191 # SOURCE LINE 16 8188 # SOURCE LINE 166 192 189 context.write(u'</table>\n\nAdd new clip:\n') 193 # SOURCE LINE 1 71190 # SOURCE LINE 169 194 191 context.write(unicode( h.form(h.url(action='addclip'), multipart=True) )) 195 192 context.write(u'\n<table style="font-size:small">\n<tr>\n <td>Start time</td>\n <td>') 196 # SOURCE LINE 17 5193 # SOURCE LINE 173 197 194 context.write(unicode( h.text_field('starttime', size=5) )) 198 195 context.write(u'</td>\n <td>a_text</td>\n <td>') 199 # SOURCE LINE 17 7196 # SOURCE LINE 175 200 197 context.write(unicode( h.text_field('a_text') )) 201 198 context.write(u'</td>\n</tr>\n<tr>\n <td>Id</td>\n <td>') 202 # SOURCE LINE 1 81199 # SOURCE LINE 179 203 200 context.write(unicode( h.text_field('id', size=5) )) 204 201 context.write(u'</td>\n <td>a_href</td>\n <td>') 205 # SOURCE LINE 18 3202 # SOURCE LINE 181 206 203 context.write(unicode( h.text_field('a_href') )) 207 204 context.write(u'</td>\n</tr>\n<tr>\n <td>img_src</td>\n <td>') 208 # SOURCE LINE 18 7205 # SOURCE LINE 185 209 206 context.write(unicode( h.text_field('img_src', size=5) )) 210 207 context.write(u'</td>\n <td>desc</td>\n <td>') 211 # SOURCE LINE 18 9208 # SOURCE LINE 187 212 209 context.write(unicode( h.text_field('desc') )) 213 210 context.write(u'</td>\n</tr>\n</table>\n') 211 # SOURCE LINE 190 212 context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) )) 213 context.write(u'\n') 214 # SOURCE LINE 191 215 context.write(unicode( h.hidden_field('itemid', value=c.itemid) )) 216 context.write(u'\n') 214 217 # SOURCE LINE 192 215 context.write(unicode( h.hidden_field('headindex', value = c.headdict['ixh']) ))216 context.write(u'\n')217 # SOURCE LINE 193218 context.write(unicode( h.hidden_field('itemid', value=c.itemid) ))219 context.write(u'\n')220 # SOURCE LINE 194221 218 context.write(unicode( h.hidden_field('hasvideo', value=c.sourcedict['has_video']) )) 222 219 context.write(u'\n\n') 223 # SOURCE LINE 19 6220 # SOURCE LINE 194 224 221 context.write(unicode( h.submit('Add') )) 225 222 context.write(u' \n') 226 # SOURCE LINE 19 7223 # SOURCE LINE 195 227 224 context.write(unicode( h.end_form() )) 228 225 context.write(u' \n</div>\n<script>\nvar plugin = document.embeds[0];\nvar input = document.api.ifield;\nvar goto = document.api.gotofield;\nvar output = document.api.ofield;\n\nfunction Play() {\n plugin.play();\n addOutput("Play!");\n}\n\nfunction Pause() {\n plugin.pause();\n addOutput("Pause!");\n}\n\nfunction SetLocation(location) {\n// plugin.setPlayPosition(location);\n plugin.setCurrentMovie(location);\n addOutput("Current movie: " + plugin.getCurrentMovie());\n addOutput("setting a location: " + location + " ms");\n}\n\nfunction GetPlayPosition() {\n addOutput("Play position: " + plugin.getPlayPosition() + " ms");\n}\n\nfunction skip(dir) {\n// addOutput("we get here")\n i = getInput();\n addOutput("i is " + i);\n if (i <= 0) i = 1000;\n addOutput("dir is " + dir);\n t = plugin.getPlayPosition() + (i * dir);\n addOutput("t is " + t);\n addOutput("Skipping by " + i + " to " + t + " ms - " +\n (plugin.setPlayPosition(t) ? "succeeded" : "failed"));\n}\n\nfunction getInput() {\n i = parseInt(input.value);\n return isNaN(i) ? 0 : i;\n}\n\nfunction getGoto() {\n i = parseInt(goto.value);\n return isNaN(i) ? 0 : i;\n}\n\n\nfunction GotoPosition() {\n i = getGoto();\n i = i * 1000;\n plugin.setPlayPosition(i);\n}\n\nvar outLines = 0;\n\nfunction addOutput(str) {\n if (outLines == 0) {\n output.value = str;\n } else {\n output.value = str + "\\n" + output.value;\n }\n outLines++;\n if (outLines == 11) {\n i = output.value.lastIndexOf("\\n");\n output.value = output.value.substr(0, i);\n outLines--;\n }\n}\n</script>\n\n')