Changeset 447 for trunk/packages
- Timestamp:
- Apr 22, 2008, 1:37:50 AM (17 years ago)
- Location:
- trunk/packages/sipb-xen-www/code
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/main.py
r446 r447 12 12 import sys 13 13 import time 14 import urllib 14 15 from StringIO import StringIO 15 16 … … 59 60 checkpoint = Checkpoint() 60 61 62 def jquote(string): 63 return "'" + string.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n') + "'" 61 64 62 65 def helppopup(subj): 63 66 """Return HTML code for a (?) link to a specified help topic""" 64 return ('<span class="helplink"><a href="help?subject=' + subj + 65 '&simple=true" target="_blank" ' + 66 'onclick="return helppopup(\'' + subj + '\')">(?)</a></span>') 67 return ('<span class="helplink"><a href="help?' + 68 cgi.escape(urllib.urlencode(dict(subject=subj, simple='true'))) 69 +'" target="_blank" ' + 70 'onclick="return helppopup(' + cgi.escape(jquote(subj)) + ')">(?)</a></span>') 67 71 68 72 def makeErrorPre(old, addition): -
trunk/packages/sipb-xen-www/code/templates/functions.tmpl
r443 r447 1 #filter WebSafe 1 2 #def databaseList($lst, $default, $onchange, $name, $id, $valueattr, $descattr) 2 3 <select name="$name" id="$id"#slurp … … 19 20 20 21 #def cdromList($default="", $onchange=None) 22 #filter None 21 23 $databaseList(sorted($sipb_xen_database.CDROM.select(), key=lambda x: x.description), 22 24 default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description') 25 #end filter 23 26 #end def 24 27 25 28 #def autoList($default="", $onchange=None) 29 #filter None 26 30 $databaseList(sorted($sipb_xen_database.Autoinstall.select(), key=lambda x: x.description), 27 31 default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description') 28 # # $databaseList(autos, default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')32 #end filter 29 33 #end def 30 34 … … 54 58 #end if 55 59 #end def 56 60 #filter None 57 61 $full_body 62 #end filter 63 #end filter -
trunk/packages/sipb-xen-www/code/templates/info.tmpl
r443 r447 41 41 #end if 42 42 <td>Boot CD:</td> 43 <td>$cdromList()</td> 43 <td>#slurp 44 #filter None 45 $cdromList()#slurp 46 #end filter 47 </td> 44 48 </tr> 45 49 <tr> … … 62 66 <input type="hidden" name="machine_id" value="$defaults.machine_id"/> 63 67 <table> 64 <tr><td>Owner${helppopup("owner")}:</td><td><input type="text" name="owner", value="$defaults.owner"/></td></tr> 68 <tr><td>Owner#slurp 69 #filter None 70 $helppopup("owner")#slurp 71 #end filter 72 :</td><td><input type="text" name="owner", value="$defaults.owner"/></td></tr> 73 #filter None 65 74 $errorRow('owner', $err) 66 <tr><td>Administrator${helppopup("administrator")}:</td><td><input type="text" name="administrator", value="$defaults.administrator"/></td></tr> 75 #end filter 76 <tr><td>Administrator#slurp 77 #filter None 78 $helppopup("administrator")#slurp 79 #end filter 80 :</td><td><input type="text" name="administrator", value="$defaults.administrator"/></td></tr> 81 #filter None 67 82 $errorRow('administrator', $err) 83 #end filter 68 84 <tr><td>Contact email:</td><td><input type="text" name="contact" value="$defaults.contact"/></td></tr> 85 #filter None 69 86 $errorRow('contact', $err) 87 #end filter 70 88 #if not $on 71 89 <tr><td>Machine Name:</td><td><input type="text" name="name" value="$defaults.name"/></td></tr> 90 #filter None 72 91 $errorRow('name', $err) 92 #end filter 73 93 <tr> 74 <td>HVM/ParaVM$helppopup('hvm_paravm')</td> 75 <td>$vmTypeList($defaults.type)</td> 94 <td>HVM/ParaVM#slurp 95 #filter None 96 $helppopup('hvm_paravm')#slurp 97 #end filter 98 </td> 99 <td>#slurp 100 #filter None 101 $vmTypeList($defaults.type)#slurp 102 #end filter 103 </td> 76 104 </tr> 77 105 <tr><td>Ram:</td><td><input type="text" size=3 name="memory" value="$defaults.memory"/>MiB (max $max_mem)</td></tr> 106 #filter None 78 107 $errorRow('memory', $err) 108 #end filter 79 109 <tr><td>Disk:</td><td><input type="text" size=3 name="disk" value="$defaults.disk"/>GiB (max $max_disk)</td><td>WARNING: Modifying disk size may corrupt your data.</td></tr> 110 #filter None 80 111 $errorRow('disk', $err) 112 #end filter 81 113 #else 114 #filter None 82 115 $errorRow('name', $err) 83 116 $errorRow('memory', $err) 84 117 $errorRow('disk', $err) 118 #end filter 85 119 #end if 86 120 <tr><td><input type="submit" class="button" name="action" value="Change"/></td></tr> … … 91 125 #def body 92 126 <div id="info"> 127 #filter None 93 128 $infoTable() 129 #end filter 94 130 </div> 95 131 96 132 <h2>Commands</h2> 97 133 <div id="commands"> 134 #filter None 98 135 $commands() 136 #end filter 99 137 </div> 100 138 <h2>Settings</h2> 101 139 <div id="modify"> 140 #filter None 102 141 $modifyForm() 142 #end filter 103 143 </div> 104 144 #end def -
trunk/packages/sipb-xen-www/code/templates/list.tmpl
r443 r447 20 20 <input type="hidden" name="back" value="list"/> 21 21 <table> 22 #filter None 22 23 $errorRow('create', $err) 24 #end filter 23 25 <tr> 24 26 <td>Name</td> 25 27 <td><input type="text" name="name" value="$defaults.name"/></td> 26 28 </tr> 29 #filter None 27 30 $errorRow('name', $err) 31 #end filter 28 32 <tr> 29 33 <td>Memory</td> 30 34 <td><input type="text" name="memory" value="$defaults.memory" size=3/> MiB ($max_memory max)</td> 31 35 </tr> 36 #filter None 32 37 $errorRow('memory', $err) 38 #end filter 33 39 <tr> 34 40 <td>Disk</td> 35 41 <td><input type="text" name="disk" value="$defaults.disk" size=3/> GiB (${"%0.1f" % ($max_disk-0.05)} max)</td> 36 42 </tr> 43 #filter None 37 44 $errorRow('disk', $err) 45 #end filter 38 46 <tr> 39 <td>HVM/ParaVM$helppopup('hvm_paravm')</td> 40 <td>$vmTypeList($defaults.type)</td> 47 <td>HVM/ParaVM#slurp 48 #filter None 49 $helppopup('hvm_paravm')#slurp 50 #end filter 51 </td> 52 <td> 53 #filter None 54 $vmTypeList($defaults.type) 55 #end filter 56 </td> 41 57 </tr> 58 #filter None 42 59 $errorRow('vmtype', $err) 60 #end filter 43 61 <tr> 44 <td>Autoinstall$helppopup('autoinstall')</td> 45 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto">$autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''") 62 <td>Autoinstall#slurp 63 #filter None 64 $helppopup('autoinstall')#slurp 65 #end filter 66 </td> 67 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_auto"> 68 #filter None 69 $autoList($defaults.cdrom, "document.getElementById('cd_or_auto_auto').checked = true;document.getElementById('cdromlist').value = ''") 46 70 (experimental; 1-2 minutes, and you have a machine; root pw is 'password'.) 71 #end filter 47 72 </input> 48 73 </tr> 49 74 <tr> 50 75 <td>Boot CD</td> 51 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked>$cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''")</td> 76 <td><input type="radio" name="cd_or_auto" id="cd_or_auto_cd" checked> 77 #filter None 78 $cdromList($defaults.cdrom, "document.getElementById('cd_or_auto_cd').checked = true;document.getElementById('autoinstalllist').value = ''") 79 #end filter 80 </td> 52 81 </input> 53 82 </tr> … … 58 87 <td><input type="text" name="owner" value="$defaults.owner"/></td> 59 88 </tr> 89 #filter None 60 90 $errorRow('owner', $err) 91 #end filter 61 92 </table> 62 93 <input type="submit" class="button" value="Create it!"/> … … 86 117 <a href="vnc?machine_id=$machine.machine_id">Console</a>#slurp 87 118 #else if $has_vnc[$machine] != 'Off' 119 #filter None 88 120 $has_vnc[$machine] 121 #end filter 89 122 #end if 90 123 </td> … … 107 140 <th>Name</th> 108 141 <th>Memory</th> 109 <th>Owner$helppopup('owner')</th> 110 <th>Administrator$helppopup('administrator')</th> 142 <th>Owner#slurp 143 #filter None 144 $helppopup('owner')#slurp 145 #end filter 146 </th> 147 <th>Administrator#slurp 148 #filter None 149 $helppopup('administrator')#slurp 150 #end filter 151 </th> 111 152 <th>IP</th> 112 153 <th>Uptime</th> … … 115 156 </tr> 116 157 #for $machine in $machines: 158 #filter None 117 159 $machineRow($machine) 160 #end filter 118 161 #end for 119 162 </table> … … 128 171 <p><a href="list">refresh</a></p> 129 172 <div id="machinelist"> 173 #filter None 130 174 $machineList($machines) 175 #end filter 131 176 </div> 177 #filter None 132 178 $createForm() 179 #end filter 133 180 #end def -
trunk/packages/sipb-xen-www/code/templates/skeleton.tmpl
r445 r447 60 60 </ul> 61 61 #end if 62 63 62 <div id="result" class="result"> 64 63 #if $varExists('result') … … 70 69 <h1>$title — SIPB Virtual Servers</h1> 71 70 #end if 71 #filter None 72 72 $body 73 #end filter 73 74 #if not $varExists('simple') or not $simple 74 75 <hr />
Note: See TracChangeset
for help on using the changeset viewer.