- Timestamp:
- Oct 8, 2007, 3:37:59 AM (17 years ago)
- Location:
- trunk/web/templates
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/templates/list.tmpl
r138 r139 80 80 </tr> 81 81 <tr> 82 <td>HVM/ParaVM </td>82 <td>HVM/ParaVM$helppopup('hvm_paravm')</td> 83 83 <td> 84 84 <input checked type="radio" name="vmtype" value="hvm">HVM</input> -
trunk/web/templates/main.py
r138 r139 25 25 pass 26 26 27 def helppopup(subj): 28 return '<span class="helplink"><a href="help?subject='+subj+'&simple=true" target="_blank" onclick="return helppopup(\''+subj+'\')">(?)</a></span>' 29 30 31 global_dict = {} 32 global_dict['helppopup'] = helppopup 33 34 27 35 # ... and stolen from xend/uuid.py 28 36 def randomUUID(): … … 48 56 def error(op, user, fields, err): 49 57 d = dict(op=op, user=user, errorMessage=str(err)) 50 print Template(file='error.tmpl', searchList= d);58 print Template(file='error.tmpl', searchList=[d, global_dict]); 51 59 52 60 def validMachineName(name): … … 268 276 machine=machine) 269 277 print Template(file='create.tmpl', 270 searchList= d);278 searchList=[d, global_dict]); 271 279 272 280 def listVms(user, fields): … … 282 290 has_vnc[m.name] = True 283 291 else: 284 help_name = 'paravm_console' 285 has_vnc[m.name] = 'ParaVM <span class="helplink"><a href="help?subject=%s&simple=true" target="_blank" onclick="return helppopup(\'%s\')">(?)</a></span>' % (help_name, help_name) 292 has_vnc[m.name] = "ParaVM"+helppopup("paravm_console") 286 293 # for m in machines: 287 294 # status = statusInfo(m) … … 295 302 uptimes=uptimes, 296 303 cdroms=CDROM.select()) 297 print Template(file='list.tmpl', searchList= d)304 print Template(file='list.tmpl', searchList=[d, global_dict]) 298 305 299 306 def testMachineId(user, machineId, exists=True): … … 346 353 authtoken=token) 347 354 print Template(file='vnc.tmpl', 348 searchList= d)355 searchList=[d, global_dict]) 349 356 350 357 def getNicInfo(data_dict, machine): … … 421 428 command=action, 422 429 machine=machine) 423 print Template(file="command.tmpl", searchList= d)430 print Template(file="command.tmpl", searchList=[d, global_dict]) 424 431 425 432 def modify(user, fields): 426 433 machine = testMachineId(user, fields.getfirst('machine_id')) 434 435 def help(user, fields): 436 simple = fields.getfirst('simple') 437 subjects = fields.getlist('subject') 438 439 mapping = dict(paravm_console=""" 440 ParaVM machines do not support console access over VNC. To access 441 these machines, you either need to boot with a liveCD and ssh in or 442 hope that the sipb-xen maintainers add support for serial consoles.""", 443 hvm_paravm=""" 444 HVM machines use the virtualization features of the processor, while 445 ParaVM machines use Xen's emulation of virtualization features. You 446 want an HVM virtualized machine.""", 447 cpu_weight="""Don't ask us! We're as mystified as you are.""") 448 449 d = dict(user=user, 450 simple=simple, 451 subjects=subjects, 452 mapping=mapping) 453 454 print Template(file="help.tmpl", searchList=[d, global_dict]) 427 455 428 456 … … 452 480 'DISK_INFO', 453 481 ('state', 'state (xen format)'), 454 ('cpu_weight', 'CPU weight' ),482 ('cpu_weight', 'CPU weight'+helppopup('cpu_weight')), 455 483 ('on_reboot', 'Action on VM reboot'), 456 484 ('on_poweroff', 'Action on VM poweroff'), … … 497 525 fields = fields) 498 526 print Template(file='info.tmpl', 499 searchList= d)527 searchList=[d, global_dict]) 500 528 501 529 mapping = dict(list=listVms, … … 504 532 modify=modify, 505 533 info=info, 506 create=create) 534 create=create, 535 help=help) 507 536 508 537 if __name__ == '__main__': … … 513 542 email = 'moo@cow.com' 514 543 u = User() 515 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen')516 544 operation = os.environ.get('PATH_INFO', '') 517 545 if not operation: … … 528 556 error(operation, u, e, 529 557 "Invalid operation '%s'" % operation)) 558 if fun not in (help, ): 559 connect('postgres://sipb-xen@sipb-xen-dev/sipb_xen') 530 560 try: 531 561 fun(u, fields) -
trunk/web/templates/skeleton.py
r113 r139 34 34 __CHEETAH_version__ = '2.0rc8' 35 35 __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8) 36 __CHEETAH_genTime__ = 1191 718104.903948137 __CHEETAH_genTimestamp__ = ' Sat Oct 6 20:48:242007'36 __CHEETAH_genTime__ = 1191828896.641397 37 __CHEETAH_genTimestamp__ = 'Mon Oct 8 03:34:56 2007' 38 38 __CHEETAH_src__ = 'skeleton.tmpl' 39 __CHEETAH_srcLastModified__ = ' Sat Oct 6 20:18:062007'39 __CHEETAH_srcLastModified__ = 'Mon Oct 8 03:34:52 2007' 40 40 __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine' 41 41 … … 88 88 _v = VFFSL(SL,"title",True) # '$title' on line 2, col 14 89 89 if _v is not None: write(_filter(_v, rawExpr='$title')) # from line 2, col 14. 90 write('''</title></head> 90 write('''</title> 91 <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> 92 <style media="screen" type="text/css"> 93 @import "static/css/all.css"; 94 </style> 95 <script type="text/javascript"> 96 var helpWin = null; 97 function closeWin(){ 98 \tif (helpWin != null){ 99 \t\tif(!helpWin.closed) 100 \t\t\thelpWin.close(); 101 \t} 102 } 103 104 function helppopup(name){ 105 closeWin() 106 helpWin = window.open("help?simple=true&subject="+encodeURIComponent(name), "HMMTHelp", 107 "status, height = 300, width = 400"); 108 if (window.focus){helpWin.focus();} 109 return false; 110 } 111 </script> 112 </head> 91 113 <body> 92 <p>[You are logged in as ''')93 _v = VFFSL(SL,"user.username",True) # '$user.username' on line 4, col 2694 if _v is not None: write(_filter(_v, rawExpr='$user.username')) # from line 4, col 26.95 write('''.]</p>96 114 ''') 97 _v = VFFSL(SL,"body",True) # '$body' on line 5, col 1 98 if _v is not None: write(_filter(_v, rawExpr='$body')) # from line 5, col 1. 115 if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 26, col 1 116 write('''<p>[You are logged in as ''') 117 _v = VFFSL(SL,"user.username",True) # '$user.username' on line 27, col 26 118 if _v is not None: write(_filter(_v, rawExpr='$user.username')) # from line 27, col 26. 119 write('''.]</p> 120 ''') 121 _v = VFFSL(SL,"body",True) # '$body' on line 29, col 1 122 if _v is not None: write(_filter(_v, rawExpr='$body')) # from line 29, col 1. 99 123 write(''' 100 <hr /> 124 ''') 125 if not VFFSL(SL,"varExists",False)('simple') or not VFFSL(SL,"simple",True): # generated from line 30, col 1 126 write('''<hr /> 101 127 Questions? Contact <a href="mailto:sipb-xen-dev@mit.edu">sipb-xen-dev@mit.edu</a>. 102 </body> 128 ''') 129 write('''</body> 103 130 </html> 104 131 ''') -
trunk/web/templates/skeleton.tmpl
r113 r139 1 1 <html> 2 <head><title>$title</title></head> 2 <head><title>$title</title> 3 <link href="/static/favicon.ico" type="image/x-icon" rel="shortcut icon"> 4 <style media="screen" type="text/css"> 5 @import "static/css/all.css"; 6 </style> 7 <script type="text/javascript"> 8 var helpWin = null; 9 function closeWin(){ 10 if (helpWin != null){ 11 if(!helpWin.closed) 12 helpWin.close(); 13 } 14 } 15 16 function helppopup(name){ 17 closeWin() 18 helpWin = window.open("help?simple=true&subject="+encodeURIComponent(name), "HMMTHelp", 19 "status, height = 300, width = 400"); 20 if (window.focus){helpWin.focus();} 21 return false; 22 } 23 </script> 24 </head> 3 25 <body> 26 #if not $varExists('simple') or not $simple 4 27 <p>[You are logged in as $user.username.]</p> 28 #end if 5 29 $body 30 #if not $varExists('simple') or not $simple 6 31 <hr /> 7 32 Questions? Contact <a href="mailto:sipb-xen-dev@mit.edu">sipb-xen-dev@mit.edu</a>. 33 #end if 8 34 </body> 9 35 </html>
Note: See TracChangeset
for help on using the changeset viewer.