Changeset 3217
- Timestamp:
- 2007-09-02 22:16:15 (1 year ago)
- Files:
-
- arkaiv/trunk/arkaiv/controllers/page.py (modified) (5 diffs)
- arkaiv/trunk/arkaiv/controllers/page.pyc (modified) (previous)
- arkaiv/trunk/arkaiv/model/__init__.py (modified) (1 diff)
- arkaiv/trunk/arkaiv/model/__init__.pyc (modified) (previous)
- arkaiv/trunk/arkaiv/model/cmmlparser.py (modified) (1 diff)
- arkaiv/trunk/arkaiv/model/cmmlparser.pyc (modified) (previous)
- arkaiv/trunk/arkaiv/templates/autohandler (modified) (2 diffs)
- arkaiv/trunk/arkaiv/templates/displayitem.mak (modified) (5 diffs)
- arkaiv/trunk/arkaiv/templates/help.mak (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
arkaiv/trunk/arkaiv/controllers/page.py
r3215 r3217 219 219 def addclip(self): 220 220 clip = {} 221 clip['starttime'] = int(request.params['starttime'])221 clip['starttime'] = float(request.params['starttime']) 222 222 clip['itemid'] = request.params['itemid'] 223 223 clip['a_text'] = request.params['a_text'] 224 clip['id'] = request.params['id']224 clip['id'] = clip['starttime'] # A kludge so users don't have to worry about providing ids 225 225 clip['a_href'] = request.params['a_href'] 226 226 clip['desc'] = request.params['desc'] … … 233 233 if has_video == "Yes": 234 234 clip['img_src'] = self.__createimageforclip(cmmlfile, clip) 235 # basename = os.path.splitext(cmmlfile)[0]236 # imagedirname = basename + "_clipimages"237 # clipimagename = str(clip['starttime']) + ".png"238 # oggsource = model.getsourcepath(clip['itemid'])239 # cwd = os.getcwd()240 # os.chdir(imagedirname) # ugly...241 # frameimage = Frame(oggsource, clip['starttime'], clipimagename)242 # os.chdir(cwd) # very ugly... #243 #244 # # add that info to the dictionary - only needs to be a relative245 # # location246 #247 # relpath = os.path.split(imagedirname)[1]248 # clip['img_src'] = relpath + "/" + clipimagename249 235 250 236 else: … … 258 244 parser = cmmlParser() 259 245 parser.addclipstocmmlfile(cmmlfile, cliplist) 260 redirect_to(action='displayitem', id=clip['itemid'], edit="yes") 246 redirect_to(action='displayitem', id=clip['itemid'], 247 playclip=clip['id'], edit="yes") 261 248 262 249 def deleteclip(self): … … 532 519 # print cwd 533 520 os.chdir(imagedirname) # ugly... 534 frameimage = Frame(oggsource, int(clipinfo['starttime']), clipimagename)521 frameimage = Frame(oggsource, float(clipinfo['starttime']), clipimagename) 535 522 print "after frameimage" 536 523 os.chdir(cwd) # very ugly... # … … 543 530 return imagefile 544 531 532 def displayhelp(self): 533 return render('/help.mak') 534 535 arkaiv/trunk/arkaiv/model/__init__.py
r3214 r3217 512 512 new_clip = Clip() 513 513 new_clip.start_time = info['starttime'] 514 new_clip.id = info[' id']514 new_clip.id = info['starttime'] 515 515 new_clip.a_href = info['a_href'] 516 516 new_clip.a_text = info['a_text'] arkaiv/trunk/arkaiv/model/cmmlparser.py
r3213 r3217 139 139 for clip in cliplist: 140 140 newclip = Etree.SubElement(root, 'clip') 141 newclip.set('id', clip['id'])141 # newclip.set('id', clip['id']) 142 142 newclip.set('start', str(clip['start_time'])) 143 newclip.set('id', clip['id'])143 newclip.set('id', str(clip['id'])) 144 144 img = Etree.SubElement(newclip, 'img') 145 145 img.set('src', str(clip['img_src'])) arkaiv/trunk/arkaiv/templates/autohandler
r3215 r3217 6 6 7 7 </head> 8 <body >8 <body onkeypress='keyPressed(event)'> 9 9 <p class="header"> 10 10 <h1>Arkaiv</h1> … … 13 13 <li>${ h.link_to("All Items", h.url(action="mainpage")) }</li> 14 14 <li>${ h.link_to("Collections", h.url(action="collections")) }</li> 15 <li>${ h.link_to("Add annodex media", h.url(action="addannodexform")) }</li> 15 <li>${ h.link_to("Add media", h.url(action="addannodexform")) }</li> 16 <li>${ h.link_to("Help", h.url(action="displayhelp")) }</li> 16 17 <li><span class="searchpadding"> 17 18 ${ h.form(h.url(action='search'), multipart=True) } arkaiv/trunk/arkaiv/templates/displayitem.mak
r3215 r3217 1 1 <%inherit file="/autohandler"/> 2 2 <div id="video"> 3 3 4 <p id="edititemname">${c.itemname}</p> 4 5 <script type="text/javascript"> … … 28 29 <td><input type="text" name="gotofield" size="5"/></td> 29 30 <td>(secs)</td> 31 <td>Disable key shortcuts:</td> 32 <td><input type="checkbox" name="shortcuts" value="toggle" onchange="toggleShortcuts()"></td> 30 33 </tr> 31 34 </table> … … 167 170 168 171 Add new clip: 169 ${ h.form(h.url(action='addclip'), multipart=True) } 170 <table style="font-size:small"> 171 <tr> 172 <td>Start time</td> 172 <!--${ h.form(h.url(action='addclip'), multipart=True) }--> 173 <form name="addaclip" action="addclip" > 174 <table style="font-size:small"> 175 <tr> 176 <td>Start</td> 173 177 <td>${ h.text_field('starttime', size=5) }</td> 178 <td>Desc</td> 179 <td> 180 <input type="text" name="desc" size="20" onfocus="disableShortcuts()" onblur="enableShortcuts()" id="desc" /> 181 <!--${ h.text_field('desc') }--></td> 182 </tr> 183 <tr> 174 184 <td>a_text</td> 175 185 <td>${ h.text_field('a_text') }</td> 176 </tr>177 <tr>178 <td>Id</td>179 <td>${ h.text_field('id', size=5) }</td>180 186 <td>a_href</td> 181 187 <td>${ h.text_field('a_href') }</td> 182 188 </tr> 183 <tr>184 <td>img_src</td>185 <td>${ h.text_field('img_src', size=5) }</td>186 <td>desc</td>187 <td>${ h.text_field('desc') }</td>188 </tr>189 189 </table> 190 190 ${ h.hidden_field('headindex', value = c.headdict['ixh']) } 191 191 ${ h.hidden_field('itemid', value=c.itemid) } 192 192 ${ h.hidden_field('hasvideo', value=c.sourcedict['has_video']) } 193 194 193 ${ h.submit('Add') } 195 194 ${ h.end_form() } 196 </div> 195 197 196 <script> 198 197 var plugin = document.embeds[0]; 199 198 var input = document.api.ifield; 199 var clipstart = document.addaclip.starttime; 200 200 var goto = document.api.gotofield; 201 201 var output = document.api.ofield; 202 var focusid = "enable"; 203 var shortcuts = document.api.shortcuts; 202 204 203 205 function Play() { 204 206 plugin.play(); 205 addOutput("Play !");207 addOutput("Play"); 206 208 } 207 209 208 210 function Pause() { 209 211 plugin.pause(); 210 addOutput("Pause !");212 addOutput("Pause"); 211 213 } 212 214 … … 220 222 function GetPlayPosition() { 221 223 addOutput("Play position: " + plugin.getPlayPosition() + " ms"); 224 } 225 226 function PauseOrPlay(){ 227 addOutput("current state: " + plugin.getCurrentState()); 228 if (plugin.getCurrentState()==0) {Play();} 229 else { 230 if (plugin.getCurrentState()==1) Pause();} 222 231 } 223 232 … … 265 274 outLines--; 266 275 } 267 } 276 277 } 278 279 function addClipStarttime() { 280 clipstart.value = plugin.getPlayPosition()/1000; 281 } 282 283 function keyPressed(e) { 284 if (focusid=="disable") {return;} 285 else { 286 switch (String.fromCharCode(e.which)) { 287 case "t": GetPlayPosition(); break; 288 case "s": addClipStarttime(); break; 289 case "p": PauseOrPlay(); break; 290 } 291 focusid="enable"; 292 } 293 } 294 function disableShortcuts() { 295 focusid="disable"; 296 addOutput("Shortcuts: " + focusid); 297 } 298 299 function enableShortcuts() { 300 focusid="enable"; 301 addOutput("Shortcuts: " + focusid); 302 } 303 304 function toggleShortcuts() { 305 if (focusid=="enable") {focusid="disable";} 306 else { 307 if (focusid=="disable") {focusid="enable";} 308 } 309 310 } 311 268 312 </script> 269 313 314