Changeset 61223 in vbox for trunk/src/VBox
- Timestamp:
- May 27, 2016 3:19:07 AM (9 years ago)
- Location:
- trunk/src/VBox/ValidationKit/testmanager/webui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py
r61217 r61223 189 189 """ 190 190 191 ## The text/symbol for a very short add link. 192 ksShortAddLink = u'\u2795' 193 ## HTML hex entity string for ksShortAddLink. 194 ksShortAddLinkHtml = '➕;' 191 195 ## The text/symbol for a very short edit link. 192 196 ksShortEditLink = u'\u270D' -
trunk/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py
r61220 r61223 69 69 oForm.addSubmit() 70 70 71 return True 71 return True; 72 72 73 73 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuihlpform.py
r61220 r61223 90 90 sError = self._dErrors[sName]; 91 91 if utils.isString(sError): # List error trick (it's an associative array). 92 return self._add( ' <li>\n'93 ' <div class="tmform-field"><div class="tmform-field-%s">\n'94 ' <label for="%s" class="tmform-error-label">%s\n'95 ' <span class="tmform-error-desc">%s</span>\n'96 ' </label>\n'92 return self._add(u' <li>\n' 93 u' <div class="tmform-field"><div class="tmform-field-%s">\n' 94 u' <label for="%s" class="tmform-error-label">%s\n' 95 u' <span class="tmform-error-desc">%s</span>\n' 96 u' </label>\n' 97 97 % (escapeAttr(sDivSubClass), escapeAttr(sName), escapeElem(sLabel), 98 98 self._escapeErrorText(sError), ) ); 99 return self._add( ' <li>\n'100 ' <div class="tmform-field"><div class="tmform-field-%s">\n'101 ' <label for="%s">%s</label>\n'99 return self._add(u' <li>\n' 100 u' <div class="tmform-field"><div class="tmform-field-%s">\n' 101 u' <label for="%s">%s</label>\n' 102 102 % (escapeAttr(sDivSubClass), escapeAttr(sName), escapeElem(sLabel)) ); 103 103 … … 108 108 """ 109 109 if not self._fFinalized: 110 self._add(' </ul>\n' 111 ' </form>\n' 112 '</div>\n' 113 '<div class="clear"></div>\n' 114 ); 110 self._add(u' </ul>\n' 111 u' </form>\n' 112 u'</div>\n' 113 u'<div class="clear"></div>\n' ); 115 114 return self._sBody; 116 115 117 116 def addTextHidden(self, sName, sValue, sExtraAttribs = ''): 118 117 """Adds a hidden text input.""" 119 return self._add( ' <div class="tmform-field-hidden">\n'120 ' <input name="%s" id="%s" type="text" hidden%s value="%s" class="tmform-hidden">\n'121 ' </div>\n'122 ' </li>\n'123 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(str(sValue)) ));118 return self._add(u' <div class="tmform-field-hidden">\n' 119 u' <input name="%s" id="%s" type="text" hidden%s value="%s" class="tmform-hidden">\n' 120 u' </div>\n' 121 u' </li>\n' 122 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(str(sValue)) )); 124 123 # 125 124 # Non-input stuff. … … 129 128 self._addLabel('non-text', sLabel, 'string'); 130 129 if sValue is None: sValue = ''; 131 return self._add( ' <p>%s</p>%s\n'132 ' </div></div>\n'133 ' </li>\n'134 % (escapeElem( str(sValue)), sPostHtml ));130 return self._add(u' <p>%s</p>%s\n' 131 u' </div></div>\n' 132 u' </li>\n' 133 % (escapeElem(unicode(sValue)), sPostHtml )); 135 134 136 135 … … 145 144 self._addLabel(sName, sLabel, sSubClass); 146 145 if sValue is None: sValue = ''; 147 return self._add( ' <input name="%s" id="%s" type="text"%s value="%s">%s\n'148 ' </div></div>\n'149 ' </li>\n'146 return self._add(u' <input name="%s" id="%s" type="text"%s value="%s">%s\n' 147 u' </div></div>\n' 148 u' </li>\n' 150 149 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sValue), sPostHtml )); 151 150 … … 155 154 self._addLabel(sName, sLabel, sSubClass); 156 155 if sValue is None: sValue = ''; 157 return self._add(' <input name="%s" id="%s" type="text" readonly%s value="%s" class="tmform-input-readonly">%s\n' 158 ' </div></div>\n' 159 ' </li>\n' 160 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(str(sValue)), sPostHtml )); 156 return self._add(u' <input name="%s" id="%s" type="text" readonly%s value="%s" class="tmform-input-readonly">' 157 u'%s\n' 158 u' </div></div>\n' 159 u' </li>\n' 160 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(unicode(sValue)), sPostHtml )); 161 161 162 162 def addWideText(self, sName, sValue, sLabel, sExtraAttribs = ''): … … 168 168 return self.addTextRO(sName, sValue, sLabel, 'wide', sExtraAttribs); 169 169 170 def _adjustMultilineTextAttribs(self, sExtraAttribs, sValue): 171 """ Internal helper for setting good default sizes for textarea based on content.""" 172 if sExtraAttribs.find('cols') < 0 and sExtraAttribs.find('width') < 0: 173 sExtraAttribs = 'cols="96%" ' + sExtraAttribs; 174 175 if sExtraAttribs.find('rows') < 0 and sExtraAttribs.find('width') < 0: 176 if sValue is None: sValue = ''; 177 else: sValue = sValue.strip(); 178 179 cRows = sValue.count('\n') + (sValue[-1] != '\n'); 180 if cRows * 80 < len(sValue): 181 cRows += 2; 182 cRows = max(min(cRows, 16), 2); 183 sExtraAttribs = ('rows="%s" ' % (cRows,)) + sExtraAttribs; 184 185 return sExtraAttribs; 170 186 171 187 def addMultilineText(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = ''): … … 176 192 self._addLabel(sName, sLabel, sSubClass) 177 193 if sValue is None: sValue = ''; 178 sNewValue = str(sValue) if not isinstance(sValue, list) else '\n'.join(sValue) 179 return self._add(' <textarea name="%s" id="%s" %s>%s</textarea>\n' 180 ' </div></div>\n' 181 ' </li>\n' 182 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sNewValue))) 194 sNewValue = unicode(sValue) if not isinstance(sValue, list) else '\n'.join(sValue) 195 return self._add(u' <textarea name="%s" id="%s" %s>%s</textarea>\n' 196 u' </div></div>\n' 197 u' </li>\n' 198 % ( escapeAttr(sName), escapeAttr(sName), self._adjustMultilineTextAttribs(sExtraAttribs, sValue), 199 escapeElem(sNewValue))) 183 200 184 201 def addMultilineTextRO(self, sName, sValue, sLabel, sSubClass = 'string', sExtraAttribs = ''): … … 187 204 self._addLabel(sName, sLabel, sSubClass) 188 205 if sValue is None: sValue = ''; 189 sNewValue = str(sValue) if not isinstance(sValue, list) else '\n'.join(sValue) 190 return self._add(' <textarea name="%s" id="%s" readonly %s>%s</textarea>\n' 191 ' </div></div>\n' 192 ' </li>\n' 193 % ( escapeAttr(sName), escapeAttr(sName), sExtraAttribs, escapeElem(sNewValue))) 206 sNewValue = unicode(sValue) if not isinstance(sValue, list) else '\n'.join(sValue) 207 return self._add(u' <textarea name="%s" id="%s" readonly %s>%s</textarea>\n' 208 u' </div></div>\n' 209 u' </li>\n' 210 % ( escapeAttr(sName), escapeAttr(sName), self._adjustMultilineTextAttribs(sExtraAttribs, sValue), 211 escapeElem(sNewValue))) 194 212 195 213 def addInt(self, sName, iValue, sLabel, sExtraAttribs = ''): 196 214 """Adds an integer input.""" 197 return self.addText(sName, str(iValue), sLabel, 'int', sExtraAttribs);215 return self.addText(sName, unicode(iValue), sLabel, 'int', sExtraAttribs); 198 216 199 217 def addIntRO(self, sName, iValue, sLabel, sExtraAttribs = ''): 200 218 """Adds an integer input.""" 201 return self.addTextRO(sName, str(iValue), sLabel, 'int', sExtraAttribs);219 return self.addTextRO(sName, unicode(iValue), sLabel, 'int', sExtraAttribs); 202 220 203 221 def addLong(self, sName, lValue, sLabel, sExtraAttribs = ''): 204 222 """Adds a long input.""" 205 return self.addText(sName, str(lValue), sLabel, 'long', sExtraAttribs);223 return self.addText(sName, unicode(lValue), sLabel, 'long', sExtraAttribs); 206 224 207 225 def addLongRO(self, sName, lValue, sLabel, sExtraAttribs = ''): 208 226 """Adds a long input.""" 209 return self.addTextRO(sName, str(lValue), sLabel, 'long', sExtraAttribs);227 return self.addTextRO(sName, unicode(lValue), sLabel, 'long', sExtraAttribs); 210 228 211 229 def addUuid(self, sName, uuidValue, sLabel, sExtraAttribs = ''): 212 230 """Adds an UUID input.""" 213 return self.addText(sName, str(uuidValue), sLabel, 'uuid', sExtraAttribs);231 return self.addText(sName, unicode(uuidValue), sLabel, 'uuid', sExtraAttribs); 214 232 215 233 def addUuidRO(self, sName, uuidValue, sLabel, sExtraAttribs = ''): 216 234 """Adds a read-only UUID input.""" 217 return self.addTextRO(sName, str(uuidValue), sLabel, 'uuid', sExtraAttribs);235 return self.addTextRO(sName, unicode(uuidValue), sLabel, 'uuid', sExtraAttribs); 218 236 219 237 def addTimestampRO(self, sName, sTimestamp, sLabel, sExtraAttribs = ''): … … 230 248 # Combo boxes. 231 249 # 232 def addComboBox(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = '' ):250 def addComboBox(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = '', sPostHtml = ''): 233 251 """Adds a combo box.""" 234 252 if self._fReadOnly: 235 return self.addComboBoxRO(sName, sSelected, sLabel, aoOptions, sExtraAttribs );253 return self.addComboBoxRO(sName, sSelected, sLabel, aoOptions, sExtraAttribs, sPostHtml); 236 254 self._addLabel(sName, sLabel, 'combobox'); 237 255 self._add(' <select name="%s" id="%s" class="tmform-combobox"%s>\n' 238 256 % (escapeAttr(sName), escapeAttr(sName), sExtraAttribs)); 239 sSelected = str(sSelected);257 sSelected = unicode(sSelected); 240 258 for iValue, sText, _ in aoOptions: 241 sValue = str(iValue);259 sValue = unicode(iValue); 242 260 self._add(' <option value="%s"%s>%s</option>\n' 243 261 % (escapeAttr(sValue), ' selected' if sValue == sSelected else '', 244 262 escapeElem(sText))); 245 return self._add(' </select>\n' 246 ' </div></div>\n' 247 ' </li>\n' 248 ); 249 250 def addComboBoxRO(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = ''): 263 return self._add(u' </select>' + sPostHtml + '\n' 264 u' </div></div>\n' 265 u' </li>\n'); 266 267 def addComboBoxRO(self, sName, sSelected, sLabel, aoOptions, sExtraAttribs = '', sPostHtml = ''): 251 268 """Adds a read-only combo box.""" 252 269 self.addTextHidden(sName, sSelected); 253 270 self._addLabel(sName, sLabel, 'combobox-readonly'); 254 self._add( ' <select name="%s" id="%s" disabled class="tmform-combobox"%s>\n'271 self._add(u' <select name="%s" id="%s" disabled class="tmform-combobox"%s>\n' 255 272 % (escapeAttr(sName), escapeAttr(sName), sExtraAttribs)); 256 sSelected = str(sSelected);273 sSelected = unicode(sSelected); 257 274 for iValue, sText, _ in aoOptions: 258 sValue = str(iValue);275 sValue = unicode(iValue); 259 276 self._add(' <option value="%s"%s>%s</option>\n' 260 277 % (escapeAttr(sValue), ' selected' if sValue == sSelected else '', 261 278 escapeElem(sText))); 262 return self._add(' </select>\n' 263 ' </div></div>\n' 264 ' </li>\n' 265 ); 279 return self._add(u' </select>' + sPostHtml + '\n' 280 u' </div></div>\n' 281 u' </li>\n'); 266 282 267 283 # … … 286 302 self._addLabel(sName, sLabel, 'checkbox'); 287 303 fChecked = self._reinterpretBool(fChecked); 288 return self._add( ' <input name="%s" id="%s" type="checkbox"%s%s value="1" class="tmform-checkbox">\n'289 ' </div></div>\n'290 ' </li>\n'304 return self._add(u' <input name="%s" id="%s" type="checkbox"%s%s value="1" class="tmform-checkbox">\n' 305 u' </div></div>\n' 306 u' </li>\n' 291 307 % (escapeAttr(sName), escapeAttr(sName), ' checked' if fChecked else '', sExtraAttribs)); 292 308 … … 296 312 fChecked = self._reinterpretBool(fChecked); 297 313 # Hack Alert! The onclick and onkeydown are for preventing editing and fake readonly/disabled. 298 return self._add( ' <input name="%s" id="%s" type="checkbox"%s readonly%s value="1" class="readonly"\n'299 ' onclick="return false" onkeydown="return false">\n'300 ' </div></div>\n'301 ' </li>\n'314 return self._add(u' <input name="%s" id="%s" type="checkbox"%s readonly%s value="1" class="readonly"\n' 315 u' onclick="return false" onkeydown="return false">\n' 316 u' </div></div>\n' 317 u' </li>\n' 302 318 % (escapeAttr(sName), escapeAttr(sName), ' checked' if fChecked else '', sExtraAttribs)); 303 319 … … 328 344 assert len(asRow) == 3; # Don't allow sloppy input data! 329 345 fChecked = self._reinterpretBool(asRow[1]) 330 self._add( ' <tr>\n'331 ' <td><input type="checkbox" name="%s" value="%s"%s%s></td>\n'332 ' <td>%s</td>\n'333 ' </tr>\n'334 % ( sNameEscaped, escapeAttr( str(asRow[0])), ' checked' if fChecked else '', sExtraAttribs,335 escapeElem(str(asRow[2])), ));336 self._add( ' </table>\n');346 self._add(u' <tr>\n' 347 u' <td><input type="checkbox" name="%s" value="%s"%s%s></td>\n' 348 u' <td>%s</td>\n' 349 u' </tr>\n' 350 % ( sNameEscaped, escapeAttr(unicode(asRow[0])), ' checked' if fChecked else '', sExtraAttribs, 351 escapeElem(unicode(asRow[2])), )); 352 self._add(u' </table>\n'); 337 353 else: 338 354 for asRow in aoRows: 339 355 assert len(asRow) == 3; # Don't allow sloppy input data! 340 356 fChecked = self._reinterpretBool(asRow[1]) 341 self._add( ' <div class="tmform-checkbox-holder">'342 '<input type="checkbox" name="%s" value="%s"%s%s> %s</input></div>\n'343 % ( sNameEscaped, escapeAttr( str(asRow[0])), ' checked' if fChecked else '', sExtraAttribs,344 escapeElem( str(asRow[2])),));345 return self._add( ' </div></div></div>\n'346 ' </li>\n');357 self._add(u' <div class="tmform-checkbox-holder">' 358 u'<input type="checkbox" name="%s" value="%s"%s%s> %s</input></div>\n' 359 % ( sNameEscaped, escapeAttr(unicode(asRow[0])), ' checked' if fChecked else '', sExtraAttribs, 360 escapeElem(unicode(asRow[2])),)); 361 return self._add(u' </div></div></div>\n' 362 u' </li>\n'); 347 363 348 364 … … 397 413 self._addLabel(sName, sLabel); 398 414 399 sTableId = 'TestArgsExtendingListRoot';415 sTableId = u'TestArgsExtendingListRoot'; 400 416 fReadOnly = self._fReadOnly; ## @todo argument? 401 sReadOnlyAttr = ' readonly class="tmform-input-readonly"' if fReadOnly else '';402 403 sHtml = '<li>\n'417 sReadOnlyAttr = u' readonly class="tmform-input-readonly"' if fReadOnly else ''; 418 419 sHtml = u'<li>\n' 404 420 405 421 # … … 410 426 # 411 427 if not fReadOnly: 412 sHtml += '<script type="text/javascript">\n'413 sHtml += '\n';414 sHtml += 'g_%s_aItems = { %s };\n' % (sName, ', '.join(('%s: 1' % (i,)) for i in range(len(aoVariations))),);415 sHtml += 'g_%s_cItems = %s;\n' % (sName, len(aoVariations),);416 sHtml += 'g_%s_iIdMod = %s;\n' % (sName, len(aoVariations) + 32);417 sHtml += '\n';418 sHtml += 'function %s_removeEntry(sId)\n' % (sName,);419 sHtml += '{\n';420 sHtml += ' if (g_%s_cItems > 1)\n' % (sName,);421 sHtml += ' {\n';422 sHtml += ' g_%s_cItems--;\n' % (sName,);423 sHtml += ' delete g_%s_aItems[sId];\n' % (sName,);424 sHtml += ' setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName);425 sHtml += '\n';428 sHtml += u'<script type="text/javascript">\n' 429 sHtml += u'\n'; 430 sHtml += u'g_%s_aItems = { %s };\n' % (sName, ', '.join(('%s: 1' % (i,)) for i in range(len(aoVariations))),); 431 sHtml += u'g_%s_cItems = %s;\n' % (sName, len(aoVariations),); 432 sHtml += u'g_%s_iIdMod = %s;\n' % (sName, len(aoVariations) + 32); 433 sHtml += u'\n'; 434 sHtml += u'function %s_removeEntry(sId)\n' % (sName,); 435 sHtml += u'{\n'; 436 sHtml += u' if (g_%s_cItems > 1)\n' % (sName,); 437 sHtml += u' {\n'; 438 sHtml += u' g_%s_cItems--;\n' % (sName,); 439 sHtml += u' delete g_%s_aItems[sId];\n' % (sName,); 440 sHtml += u' setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName); 441 sHtml += u'\n'; 426 442 for iInput in range(8): 427 sHtml += ' removeHtmlNode(\'%s[\' + sId + \'][%s]\');\n' % (sName, iInput,);428 sHtml += ' }\n';429 sHtml += '}\n';430 sHtml += '\n';431 sHtml += 'function %s_extendListEx(cGangMembers, cSecTimeout, sArgs, sTestBoxReqExpr, sBuildReqExpr)\n' % (sName,);432 sHtml += '{\n';433 sHtml += ' var oElement = document.getElementById(\'%s\');\n' % (sTableId,);434 sHtml += ' var oTBody = document.createElement(\'tbody\');\n';435 sHtml += ' var sHtml = \'\';\n';436 sHtml += ' var sId;\n';437 sHtml += '\n';438 sHtml += ' g_%s_iIdMod += 1;\n' % (sName,);439 sHtml += ' sId = g_%s_iIdMod.toString();\n' % (sName,);443 sHtml += u' removeHtmlNode(\'%s[\' + sId + \'][%s]\');\n' % (sName, iInput,); 444 sHtml += u' }\n'; 445 sHtml += u'}\n'; 446 sHtml += u'\n'; 447 sHtml += u'function %s_extendListEx(cGangMembers, cSecTimeout, sArgs, sTestBoxReqExpr, sBuildReqExpr)\n' % (sName,); 448 sHtml += u'{\n'; 449 sHtml += u' var oElement = document.getElementById(\'%s\');\n' % (sTableId,); 450 sHtml += u' var oTBody = document.createElement(\'tbody\');\n'; 451 sHtml += u' var sHtml = \'\';\n'; 452 sHtml += u' var sId;\n'; 453 sHtml += u'\n'; 454 sHtml += u' g_%s_iIdMod += 1;\n' % (sName,); 455 sHtml += u' sId = g_%s_iIdMod.toString();\n' % (sName,); 440 456 441 457 oVarDefaults = TestCaseArgsData(); 442 458 oVarDefaults.convertToParamNull(); 443 sHtml += '\n';444 sHtml += ' sHtml += \'<tr class="tmform-testcasevars-first-row">\';\n';445 sHtml += ' sHtml += \' <td>Gang Members:</td>\';\n';446 sHtml += ' sHtml += \' <td class="tmform-field-tiny-int">' \447 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][0]" value="\' + cGangMembers + \'"></td>\';\n' \459 sHtml += u'\n'; 460 sHtml += u' sHtml += \'<tr class="tmform-testcasevars-first-row">\';\n'; 461 sHtml += u' sHtml += \' <td>Gang Members:</td>\';\n'; 462 sHtml += u' sHtml += \' <td class="tmform-field-tiny-int">' \ 463 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][0]" value="\' + cGangMembers + \'"></td>\';\n' \ 448 464 % (sName, TestCaseArgsData.ksParam_cGangMembers, sName,); 449 sHtml += ' sHtml += \' <td>Timeout:</td>\';\n';450 sHtml += ' sHtml += \' <td class="tmform-field-int">' \451 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][1]" value="\'+ cSecTimeout + \'"></td>\';\n' \465 sHtml += u' sHtml += \' <td>Timeout:</td>\';\n'; 466 sHtml += u' sHtml += \' <td class="tmform-field-int">' \ 467 u'<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][1]" value="\'+ cSecTimeout + \'"></td>\';\n' \ 452 468 % (sName, TestCaseArgsData.ksParam_cSecTimeout, sName,); 453 sHtml += ' sHtml += \' <td><a href="#" onclick="%s_removeEntry(\\\'\' + sId + \'\\\');"> Remove</a></td>\';\n' \469 sHtml += u' sHtml += \' <td><a href="#" onclick="%s_removeEntry(\\\'\' + sId + \'\\\');"> Remove</a></td>\';\n' \ 454 470 % (sName, ); 455 sHtml += ' sHtml += \' <td></td>\';\n';456 sHtml += ' sHtml += \'</tr>\';\n'457 sHtml += '\n';458 sHtml += ' sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n';459 sHtml += ' sHtml += \' <td>Arguments:</td>\';\n';460 sHtml += ' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \461 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sArgs + \'"></td>\';\n' \471 sHtml += u' sHtml += \' <td></td>\';\n'; 472 sHtml += u' sHtml += \'</tr>\';\n' 473 sHtml += u'\n'; 474 sHtml += u' sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n'; 475 sHtml += u' sHtml += \' <td>Arguments:</td>\';\n'; 476 sHtml += u' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \ 477 u'<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sArgs + \'"></td>\';\n' \ 462 478 % (sName, TestCaseArgsData.ksParam_sArgs, sName,); 463 sHtml += ' sHtml += \' <td></td>\';\n';464 sHtml += ' sHtml += \'</tr>\';\n'465 sHtml += '\n';466 sHtml += ' sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n';467 sHtml += ' sHtml += \' <td>TestBox Reqs:</td>\';\n';468 sHtml += ' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \469 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sTestBoxReqExpr' \470 ' + \'"></td>\';\n' \479 sHtml += u' sHtml += \' <td></td>\';\n'; 480 sHtml += u' sHtml += \'</tr>\';\n' 481 sHtml += u'\n'; 482 sHtml += u' sHtml += \'<tr class="tmform-testcasevars-inner-row">\';\n'; 483 sHtml += u' sHtml += \' <td>TestBox Reqs:</td>\';\n'; 484 sHtml += u' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \ 485 u'<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sTestBoxReqExpr' \ 486 u' + \'"></td>\';\n' \ 471 487 % (sName, TestCaseArgsData.ksParam_sTestBoxReqExpr, sName,); 472 sHtml += ' sHtml += \' <td></td>\';\n';473 sHtml += ' sHtml += \'</tr>\';\n'474 sHtml += '\n';475 sHtml += ' sHtml += \'<tr class="tmform-testcasevars-final-row">\';\n';476 sHtml += ' sHtml += \' <td>Build Reqs:</td>\';\n';477 sHtml += ' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \478 '<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sBuildReqExpr + \'"></td>\';\n' \488 sHtml += u' sHtml += \' <td></td>\';\n'; 489 sHtml += u' sHtml += \'</tr>\';\n' 490 sHtml += u'\n'; 491 sHtml += u' sHtml += \'<tr class="tmform-testcasevars-final-row">\';\n'; 492 sHtml += u' sHtml += \' <td>Build Reqs:</td>\';\n'; 493 sHtml += u' sHtml += \' <td class="tmform-field-wide100" colspan="4">' \ 494 u'<input name="%s[\' + sId + \'][%s]" id="%s[\' + sId + \'][2]" value="\' + sBuildReqExpr + \'"></td>\';\n' \ 479 495 % (sName, TestCaseArgsData.ksParam_sBuildReqExpr, sName,); 480 sHtml += ' sHtml += \' <td></td>\';\n';481 sHtml += ' sHtml += \'</tr>\';\n'482 sHtml += '\n';483 sHtml += ' oTBody.id = \'%s[\' + sId + \'][6]\';\n' % (sName,);484 sHtml += ' oTBody.innerHTML = sHtml;\n';485 sHtml += '\n';486 sHtml += ' oElement.appendChild(oTBody);\n';487 sHtml += '\n';488 sHtml += ' g_%s_aItems[sId] = 1;\n' % (sName,);489 sHtml += ' g_%s_cItems++;\n' % (sName,);490 sHtml += ' setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName);491 sHtml += '}\n';492 sHtml += 'function %s_extendList()\n' % (sName,);493 sHtml += '{\n';494 sHtml += ' %s_extendListEx("%s", "%s", "%s", "%s", "%s");\n' % (sName,495 escapeAttr( str(oVarDefaults.cGangMembers)), escapeAttr(str(oVarDefaults.cSecTimeout)),496 sHtml += u' sHtml += \' <td></td>\';\n'; 497 sHtml += u' sHtml += \'</tr>\';\n' 498 sHtml += u'\n'; 499 sHtml += u' oTBody.id = \'%s[\' + sId + \'][6]\';\n' % (sName,); 500 sHtml += u' oTBody.innerHTML = sHtml;\n'; 501 sHtml += u'\n'; 502 sHtml += u' oElement.appendChild(oTBody);\n'; 503 sHtml += u'\n'; 504 sHtml += u' g_%s_aItems[sId] = 1;\n' % (sName,); 505 sHtml += u' g_%s_cItems++;\n' % (sName,); 506 sHtml += u' setElementValueToKeyList(\'%s\', g_%s_aItems);\n' % (sName, sName); 507 sHtml += u'}\n'; 508 sHtml += u'function %s_extendList()\n' % (sName,); 509 sHtml += u'{\n'; 510 sHtml += u' %s_extendListEx("%s", "%s", "%s", "%s", "%s");\n' % (sName, 511 escapeAttr(unicode(oVarDefaults.cGangMembers)), escapeAttr(unicode(oVarDefaults.cSecTimeout)), 496 512 escapeAttr(oVarDefaults.sArgs), escapeAttr(oVarDefaults.sTestBoxReqExpr), 497 513 escapeAttr(oVarDefaults.sBuildReqExpr), ); 498 sHtml += '}\n';514 sHtml += u'}\n'; 499 515 if config.g_kfVBoxSpecific: 500 sSecTimeoutDef = escapeAttr( str(oVarDefaults.cSecTimeout));501 sHtml += 'function vbox_%s_add_uni()\n' % (sName,);502 sHtml += '{\n';503 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes raw", ' \504 ' "", "");\n' % (sName, sSecTimeoutDef);505 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \506 ' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef);507 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \508 ' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef);509 sHtml += '}\n';510 sHtml += 'function vbox_%s_add_uni_amd64()\n' % (sName,);511 sHtml += '{\n';512 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \513 ' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef);514 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \515 ' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef);516 sHtml += '}\n';517 sHtml += 'function vbox_%s_add_smp()\n' % (sName,);518 sHtml += '{\n';519 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt",' \520 ' "fCpuHwVirt is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef);521 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt-np",' \522 ' "fCpuNestedPaging is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef);523 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 3 --virt-modes hwvirt",' \524 ' "fCpuHwVirt is True and cCpus >= 3", "");\n' % (sName, sSecTimeoutDef);525 sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 4 --virt-modes hwvirt-np ",' \526 ' "fCpuNestedPaging is True and cCpus >= 4", "");\n' % (sName, sSecTimeoutDef);527 #sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 6 --virt-modes hwvirt",' \528 # ' "fCpuHwVirt is True and cCpus >= 6", "");\n' % (sName, sSecTimeoutDef);529 #sHtml += ' %s_extendListEx("1", "%s", "--cpu-counts 8 --virt-modes hwvirt-np",' \530 # ' "fCpuNestedPaging is True and cCpus >= 8", "");\n' % (sName, sSecTimeoutDef);531 sHtml += '}\n';532 sHtml += '</script>\n';516 sSecTimeoutDef = escapeAttr(unicode(oVarDefaults.cSecTimeout)); 517 sHtml += u'function vbox_%s_add_uni()\n' % (sName,); 518 sHtml += u'{\n'; 519 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes raw", ' \ 520 u' "", "");\n' % (sName, sSecTimeoutDef); 521 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \ 522 u' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef); 523 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \ 524 u' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef); 525 sHtml += u'}\n'; 526 sHtml += u'function vbox_%s_add_uni_amd64()\n' % (sName,); 527 sHtml += u'{\n'; 528 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt", ' \ 529 u' "fCpuHwVirt is True", "");\n' % (sName, sSecTimeoutDef); 530 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 1 --virt-modes hwvirt-np", ' \ 531 u' "fCpuNestedPaging is True", "");\n' % (sName, sSecTimeoutDef); 532 sHtml += u'}\n'; 533 sHtml += u'function vbox_%s_add_smp()\n' % (sName,); 534 sHtml += u'{\n'; 535 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt",' \ 536 u' "fCpuHwVirt is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef); 537 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 2 --virt-modes hwvirt-np",' \ 538 u' "fCpuNestedPaging is True and cCpus >= 2", "");\n' % (sName, sSecTimeoutDef); 539 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 3 --virt-modes hwvirt",' \ 540 u' "fCpuHwVirt is True and cCpus >= 3", "");\n' % (sName, sSecTimeoutDef); 541 sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 4 --virt-modes hwvirt-np ",' \ 542 u' "fCpuNestedPaging is True and cCpus >= 4", "");\n' % (sName, sSecTimeoutDef); 543 #sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 6 --virt-modes hwvirt",' \ 544 # u' "fCpuHwVirt is True and cCpus >= 6", "");\n' % (sName, sSecTimeoutDef); 545 #sHtml += u' %s_extendListEx("1", "%s", "--cpu-counts 8 --virt-modes hwvirt-np",' \ 546 # u' "fCpuNestedPaging is True and cCpus >= 8", "");\n' % (sName, sSecTimeoutDef); 547 sHtml += u'}\n'; 548 sHtml += u'</script>\n'; 533 549 534 550 … … 536 552 # List current entries. 537 553 # 538 sHtml += '<input type="hidden" name="%s" id="%s" value="%s">\n' \539 % (sName, sName, ','.join( str(i) for i in range(len(aoVariations))), );540 sHtml += ' <table id="%s" class="tmform-testcasevars">\n' % (sTableId,)554 sHtml += u'<input type="hidden" name="%s" id="%s" value="%s">\n' \ 555 % (sName, sName, ','.join(unicode(i) for i in range(len(aoVariations))), ); 556 sHtml += u' <table id="%s" class="tmform-testcasevars">\n' % (sTableId,) 541 557 if not fReadOnly: 542 sHtml += ' <caption>\n' \543 ' <a href="#" onClick="%s_extendList()">Add</a>\n' % (sName,);558 sHtml += u' <caption>\n' \ 559 u' <a href="#" onClick="%s_extendList()">Add</a>\n' % (sName,); 544 560 if config.g_kfVBoxSpecific: 545 sHtml += ' [<a href="#" onClick="vbox_%s_add_uni()">Single CPU Variations</a>\n' % (sName,);546 sHtml += ' <a href="#" onClick="vbox_%s_add_uni_amd64()">amd64</a>]\n' % (sName,);547 sHtml += ' [<a href="#" onClick="vbox_%s_add_smp()">SMP Variations</a>]\n' % (sName,);548 sHtml += ' </caption>\n';561 sHtml += u' [<a href="#" onClick="vbox_%s_add_uni()">Single CPU Variations</a>\n' % (sName,); 562 sHtml += u' <a href="#" onClick="vbox_%s_add_uni_amd64()">amd64</a>]\n' % (sName,); 563 sHtml += u' [<a href="#" onClick="vbox_%s_add_smp()">SMP Variations</a>]\n' % (sName,); 564 sHtml += u' </caption>\n'; 549 565 550 566 dSubErrors = {}; … … 556 572 oVar.convertToParamNull(); 557 573 558 sHtml += '<tbody id="%s[%s][6]">\n' % (sName, iVar,)559 sHtml += ' <tr class="tmform-testcasevars-first-row">\n' \560 ' <td>Gang Members:</td>' \561 ' <td class="tmform-field-tiny-int"><input name="%s[%s][%s]" id="%s[%s][1]" value="%s"%s></td>\n' \562 ' <td>Timeout:</td>' \563 ' <td class="tmform-field-int"><input name="%s[%s][%s]" id="%s[%s][2]" value="%s"%s></td>\n' \574 sHtml += u'<tbody id="%s[%s][6]">\n' % (sName, iVar,) 575 sHtml += u' <tr class="tmform-testcasevars-first-row">\n' \ 576 u' <td>Gang Members:</td>' \ 577 u' <td class="tmform-field-tiny-int"><input name="%s[%s][%s]" id="%s[%s][1]" value="%s"%s></td>\n' \ 578 u' <td>Timeout:</td>' \ 579 u' <td class="tmform-field-int"><input name="%s[%s][%s]" id="%s[%s][2]" value="%s"%s></td>\n' \ 564 580 % ( sName, iVar, TestCaseArgsData.ksParam_cGangMembers, sName, iVar, oVar.cGangMembers, sReadOnlyAttr, 565 581 sName, iVar, TestCaseArgsData.ksParam_cSecTimeout, sName, iVar, 566 582 utils.formatIntervalSeconds2(oVar.cSecTimeout), sReadOnlyAttr, ); 567 583 if not fReadOnly: 568 sHtml += ' <td><a href="#" onclick="%s_removeEntry(\'%s\');">Remove</a></td>\n' \584 sHtml += u' <td><a href="#" onclick="%s_removeEntry(\'%s\');">Remove</a></td>\n' \ 569 585 % (sName, iVar); 570 586 else: 571 sHtml += 572 sHtml += ' <td class="tmform-testcasevars-stupid-border-column"></td>\n' \573 ' </tr>\n';574 575 sHtml += ' <tr class="tmform-testcasevars-inner-row">\n' \576 ' <td>Arguments:</td>' \577 ' <td class="tmform-field-wide100" colspan="4">' \578 '<input name="%s[%s][%s]" id="%s[%s][3]" value="%s"%s></td>\n' \579 ' <td></td>\n' \580 ' </tr>\n' \587 sHtml += u' <td></td>\n'; 588 sHtml += u' <td class="tmform-testcasevars-stupid-border-column"></td>\n' \ 589 u' </tr>\n'; 590 591 sHtml += u' <tr class="tmform-testcasevars-inner-row">\n' \ 592 u' <td>Arguments:</td>' \ 593 u' <td class="tmform-field-wide100" colspan="4">' \ 594 u'<input name="%s[%s][%s]" id="%s[%s][3]" value="%s"%s></td>\n' \ 595 u' <td></td>\n' \ 596 u' </tr>\n' \ 581 597 % ( sName, iVar, TestCaseArgsData.ksParam_sArgs, sName, iVar, escapeAttr(oVar.sArgs), sReadOnlyAttr) 582 598 583 sHtml += ' <tr class="tmform-testcasevars-inner-row">\n' \584 ' <td>TestBox Reqs:</td>' \585 ' <td class="tmform-field-wide100" colspan="4">' \586 '<input name="%s[%s][%s]" id="%s[%s][4]" value="%s"%s></td>\n' \587 ' <td></td>\n' \588 ' </tr>\n' \599 sHtml += u' <tr class="tmform-testcasevars-inner-row">\n' \ 600 u' <td>TestBox Reqs:</td>' \ 601 u' <td class="tmform-field-wide100" colspan="4">' \ 602 u'<input name="%s[%s][%s]" id="%s[%s][4]" value="%s"%s></td>\n' \ 603 u' <td></td>\n' \ 604 u' </tr>\n' \ 589 605 % ( sName, iVar, TestCaseArgsData.ksParam_sTestBoxReqExpr, sName, iVar, 590 606 escapeAttr(oVar.sTestBoxReqExpr), sReadOnlyAttr) 591 607 592 sHtml += ' <tr class="tmform-testcasevars-final-row">\n' \593 ' <td>Build Reqs:</td>' \594 ' <td class="tmform-field-wide100" colspan="4">' \595 '<input name="%s[%s][%s]" id="%s[%s][5]" value="%s"%s></td>\n' \596 ' <td></td>\n' \597 ' </tr>\n' \608 sHtml += u' <tr class="tmform-testcasevars-final-row">\n' \ 609 u' <td>Build Reqs:</td>' \ 610 u' <td class="tmform-field-wide100" colspan="4">' \ 611 u'<input name="%s[%s][%s]" id="%s[%s][5]" value="%s"%s></td>\n' \ 612 u' <td></td>\n' \ 613 u' </tr>\n' \ 598 614 % ( sName, iVar, TestCaseArgsData.ksParam_sBuildReqExpr, sName, iVar, 599 615 escapeAttr(oVar.sBuildReqExpr), sReadOnlyAttr) … … 601 617 602 618 if iVar in dSubErrors: 603 sHtml += ' <tr><td colspan="4"><p align="left" class="tmform-error-desc">%s</p></td></tr>\n' \619 sHtml += u' <tr><td colspan="4"><p align="left" class="tmform-error-desc">%s</p></td></tr>\n' \ 604 620 % (self._escapeErrorText(dSubErrors[iVar]),); 605 621 606 sHtml += '</tbody>\n';607 sHtml += ' </table>\n'608 sHtml += '</li>\n'622 sHtml += u'</tbody>\n'; 623 sHtml += u' </table>\n' 624 sHtml += u'</li>\n' 609 625 610 626 return self._add(sHtml) … … 620 636 return self._add('<li>No testcases available.</li>\n') 621 637 622 self._add( '<input name="%s" type="hidden" value="%s">\n'638 self._add(u'<input name="%s" type="hidden" value="%s">\n' 623 639 % ( TestGroupDataEx.ksParam_aidTestCases, 624 ','.join([ str(oTestCase.idTestCase) for oTestCase in aoAllTestCases]), ));625 626 self._add( '<table class="tmformtbl">\n'627 ' <thead>\n'628 ' <tr>\n'629 ' <th rowspan="2"></th>\n'630 ' <th rowspan="2">Test Case</th>\n'631 ' <th rowspan="2">All Vars</th>\n'632 ' <th rowspan="2">Priority [0..31]</th>\n'633 ' <th colspan="4" align="center">Variations</th>\n'634 ' </tr>\n'635 ' <tr>\n'636 ' <th>Included</th>\n'637 ' <th>Gang size</th>\n'638 ' <th>Timeout</th>\n'639 ' <th>Arguments</th>\n'640 ' </tr>\n'641 ' </thead>\n'642 ' <tbody>\n'640 ','.join([unicode(oTestCase.idTestCase) for oTestCase in aoAllTestCases]), )); 641 642 self._add(u'<table class="tmformtbl">\n' 643 u' <thead>\n' 644 u' <tr>\n' 645 u' <th rowspan="2"></th>\n' 646 u' <th rowspan="2">Test Case</th>\n' 647 u' <th rowspan="2">All Vars</th>\n' 648 u' <th rowspan="2">Priority [0..31]</th>\n' 649 u' <th colspan="4" align="center">Variations</th>\n' 650 u' </tr>\n' 651 u' <tr>\n' 652 u' <th>Included</th>\n' 653 u' <th>Gang size</th>\n' 654 u' <th>Timeout</th>\n' 655 u' <th>Arguments</th>\n' 656 u' </tr>\n' 657 u' </thead>\n' 658 u' <tbody>\n' 643 659 ); 644 660 … … 660 676 661 677 # Start on the rows... 662 sPrefix = '%s[%d]' % (sName, oTestCase.idTestCase,);663 self._add( ' <tr class="%s">\n'664 ' <td rowspan="%d">\n'665 ' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestCase666 ' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup667 ' <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire668 ' <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective669 ' <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor670 ' <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list)671 ' </td>\n'678 sPrefix = u'%s[%d]' % (sName, oTestCase.idTestCase,); 679 self._add(u' <tr class="%s">\n' 680 u' <td rowspan="%d">\n' 681 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestCase 682 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup 683 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire 684 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective 685 u' <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor 686 u' <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list) 687 u' </td>\n' 672 688 % ( 'tmodd' if iTestCase & 1 else 'tmeven', 673 689 len(oTestCase.aoTestCaseArgs), … … 680 696 oTestCase.idTestCase, oTestCase.idTestCase, escapeElem(oTestCase.sName), 681 697 )); 682 self._add( ' <td rowspan="%d" align="left">%s</td>\n'698 self._add(u' <td rowspan="%d" align="left">%s</td>\n' 683 699 % ( len(oTestCase.aoTestCaseArgs), escapeElem(oTestCase.sName), )); 684 700 685 self._add( ' <td rowspan="%d" title="Include all variations (checked) or choose a set?">\n'686 ' <input name="%s[%s]" type="checkbox"%s%s value="-1">\n'687 ' </td>\n'701 self._add(u' <td rowspan="%d" title="Include all variations (checked) or choose a set?">\n' 702 u' <input name="%s[%s]" type="checkbox"%s%s value="-1">\n' 703 u' </td>\n' 688 704 % ( len(oTestCase.aoTestCaseArgs), 689 705 sPrefix, TestGroupMemberData.ksParam_aidTestCaseArgs, 690 706 ' checked' if oMember is None or oMember.aidTestCaseArgs is None else '', sCheckBoxAttr, )); 691 707 692 self._add( ' <td rowspan="%d" align="center">\n'693 ' <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n'694 ' </td>\n'708 self._add(u' <td rowspan="%d" align="center">\n' 709 u' <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n' 710 u' </td>\n' 695 711 % ( len(oTestCase.aoTestCaseArgs), 696 712 sPrefix, TestGroupMemberData.ksParam_iSchedPriority, … … 704 720 if iVar > 0: 705 721 self._add(' <tr class="%s">\n' % ('tmodd' if iTestCase & 1 else 'tmeven',)); 706 self._add( ' <td align="center">\n'707 ' <input name="%s[%s]" type="checkbox"%s%s value="%d">'708 ' </td>\n'722 self._add(u' <td align="center">\n' 723 u' <input name="%s[%s]" type="checkbox"%s%s value="%d">' 724 u' </td>\n' 709 725 % ( sPrefix, TestGroupMemberData.ksParam_aidTestCaseArgs, 710 726 ' checked' if oVar.idTestCaseArgs in aidTestCaseArgs else '', sCheckBoxAttr, oVar.idTestCaseArgs, 711 727 )); 712 self._add( ' <td align="center">%s</td>\n'713 ' <td align="center">%s</td>\n'714 ' <td align="left">%s</td>\n'728 self._add(u' <td align="center">%s</td>\n' 729 u' <td align="center">%s</td>\n' 730 u' <td align="left">%s</td>\n' 715 731 % ( oVar.cGangMembers, 716 732 'Default' if oVar.cSecTimeout is None else oVar.cSecTimeout, 717 733 escapeElem(oVar.sArgs) )); 718 734 719 self._add( ' </tr>\n');735 self._add(u' </tr>\n'); 720 736 721 737 722 738 723 739 if len(oTestCase.aoTestCaseArgs) == 0: 724 self._add( ' <td></td> <td></td> <td></td> <td></td>\n'725 ' </tr>\n');726 return self._add( ' </tbody>\n'727 '</table>\n');740 self._add(u' <td></td> <td></td> <td></td> <td></td>\n' 741 u' </tr>\n'); 742 return self._add(u' </tbody>\n' 743 u'</table>\n'); 728 744 729 745 def addListOfSchedGroupMembers(self, sName, aoSchedGroupMembers, aoAllTestGroups, # pylint: disable=R0914 … … 737 753 self._addLabel(sName, sLabel); 738 754 if len(aoAllTestGroups) == 0: 739 return self._add( '<li>No test groups available.</li>\n')740 741 self._add( '<input name="%s" type="hidden" value="%s">\n'755 return self._add(u'<li>No test groups available.</li>\n') 756 757 self._add(u'<input name="%s" type="hidden" value="%s">\n' 742 758 % ( SchedGroupDataEx.ksParam_aidTestGroups, 743 ','.join([ str(oTestGroup.idTestGroup) for oTestGroup in aoAllTestGroups]), ));744 745 self._add( '<table class="tmformtbl">\n'746 ' <thead>\n'747 ' <tr>\n'748 ' <th></th>\n'749 ' <th>Test Group</th>\n'750 ' <th>Priority [0..31]</th>\n'751 ' <th>Prerequisite Test Group</th>\n'752 ' <th>Weekly schedule</th>\n'753 ' </tr>\n'754 ' </thead>\n'755 ' <tbody>\n'759 ','.join([unicode(oTestGroup.idTestGroup) for oTestGroup in aoAllTestGroups]), )); 760 761 self._add(u'<table class="tmformtbl">\n' 762 u' <thead>\n' 763 u' <tr>\n' 764 u' <th></th>\n' 765 u' <th>Test Group</th>\n' 766 u' <th>Priority [0..31]</th>\n' 767 u' <th>Prerequisite Test Group</th>\n' 768 u' <th>Weekly schedule</th>\n' 769 u' </tr>\n' 770 u' </thead>\n' 771 u' <tbody>\n' 756 772 ); 757 773 758 sCheckBoxAttr = ' readonly onclick="return false" onkeydown="return false"' if fReadOnly else '';759 sComboBoxAttr = ' disabled' if fReadOnly else '';774 sCheckBoxAttr = u' readonly onclick="return false" onkeydown="return false"' if fReadOnly else ''; 775 sComboBoxAttr = u' disabled' if fReadOnly else ''; 760 776 761 777 oDefMember = SchedGroupMemberData(); … … 772 788 773 789 # Start on the rows... 774 sPrefix = '%s[%d]' % (sName, oTestGroup.idTestGroup,);775 self._add( ' <tr class="%s">\n'776 ' <td>\n'777 ' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup778 ' <input name="%s[%s]" type="hidden" value="%s">\n' # idSchedGroup779 ' <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire780 ' <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective781 ' <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor782 ' <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list)783 ' </td>\n'790 sPrefix = u'%s[%d]' % (sName, oTestGroup.idTestGroup,); 791 self._add(u' <tr class="%s">\n' 792 u' <td>\n' 793 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idTestGroup 794 u' <input name="%s[%s]" type="hidden" value="%s">\n' # idSchedGroup 795 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsExpire 796 u' <input name="%s[%s]" type="hidden" value="%s">\n' # tsEffective 797 u' <input name="%s[%s]" type="hidden" value="%s">\n' # uidAuthor 798 u' <input name="%s" type="checkbox"%s%s value="%d" class="tmform-checkbox" title="#%d - %s">\n' #(list) 799 u' </td>\n' 784 800 % ( 'tmodd' if iTestGroup & 1 else 'tmeven', 785 801 sPrefix, SchedGroupMemberData.ksParam_idTestGroup, oTestGroup.idTestGroup, … … 791 807 oTestGroup.idTestGroup, oTestGroup.idTestGroup, escapeElem(oTestGroup.sName), 792 808 )); 793 self._add( ' <td align="left">%s</td>\n' % ( escapeElem(oTestGroup.sName), ));794 795 self._add( ' <td align="center">\n'796 ' <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n'797 ' </td>\n'809 self._add(u' <td align="left">%s</td>\n' % ( escapeElem(oTestGroup.sName), )); 810 811 self._add(u' <td align="center">\n' 812 u' <input name="%s[%s]" type="text" value="%s" style="max-width:3em;" %s>\n' 813 u' </td>\n' 798 814 % ( sPrefix, SchedGroupMemberData.ksParam_iSchedPriority, 799 815 (oMember if oMember is not None else oDefMember).iSchedPriority, 800 816 ' readonly class="tmform-input-readonly"' if fReadOnly else '', )); 801 817 802 self._add( ' <td align="center">\n'803 ' <select name="%s[%s]" id="%s[%s]" class="tmform-combobox"%s>\n'804 ' <option value="-1"%s>None</option>\n'818 self._add(u' <td align="center">\n' 819 u' <select name="%s[%s]" id="%s[%s]" class="tmform-combobox"%s>\n' 820 u' <option value="-1"%s>None</option>\n' 805 821 % ( sPrefix, SchedGroupMemberData.ksParam_idTestGroupPreReq, 806 822 sPrefix, SchedGroupMemberData.ksParam_idTestGroupPreReq, … … 813 829 self._add(' <option value="%s"%s>%s</option>\n' 814 830 % ( oTestGroup2.idTestGroup, ' selected' if fSelected else '', escapeElem(oTestGroup2.sName), )); 815 self._add( ' </select>\n'816 ' </td>\n');817 818 self._add( ' <td align="left">\n'819 ' Todo<input name="%s[%s]" type="hidden" value="%s">\n'820 ' </td>\n'831 self._add(u' </select>\n' 832 u' </td>\n'); 833 834 self._add(u' <td align="left">\n' 835 u' Todo<input name="%s[%s]" type="hidden" value="%s">\n' 836 u' </td>\n' 821 837 % ( sPrefix, SchedGroupMemberData.ksParam_bmHourlySchedule, 822 838 '' if oMember is None else oMember.bmHourlySchedule, )); 823 839 824 self._add( ' </tr>\n');825 return self._add( ' </tbody>\n'826 '</table>\n');840 self._add(u' </tr>\n'); 841 return self._add(u' </tbody>\n' 842 u'</table>\n'); 827 843 828 844 # … … 833 849 if self._fReadOnly: 834 850 return True; 835 return self._add( ' <li>\n'836 ' <br>\n'837 ' <div class="tmform-field"><div class="tmform-field-submit">\n'838 ' <label> </label>\n'839 ' <input type="submit" value="%s">\n'840 ' </div></div>\n'841 ' </li>\n'851 return self._add(u' <li>\n' 852 u' <br>\n' 853 u' <div class="tmform-field"><div class="tmform-field-submit">\n' 854 u' <label> </label>\n' 855 u' <input type="submit" value="%s">\n' 856 u' </div></div>\n' 857 u' </li>\n' 842 858 % (escapeElem(sLabel),)); 843 859 … … 846 862 if self._fReadOnly: 847 863 return True; 848 return self._add(' <li>\n' 849 ' <div class="tmform-button"><div class="tmform-button-reset">\n' 850 ' <input type="reset" value="%s">\n' 851 ' </div></div>\n' 852 ' </li>\n' 853 ); 854 864 return self._add(u' <li>\n' 865 u' <div class="tmform-button"><div class="tmform-button-reset">\n' 866 u' <input type="reset" value="%s">\n' 867 u' </div></div>\n' 868 u' </li>\n'); 869 -
trunk/src/VBox/ValidationKit/testmanager/webui/wuitestresult.py
r61220 r61223 47 47 from testmanager import config; 48 48 from common import webutils, utils; 49 50 51 class WuiFailureReasonDetailsLink(WuiTmLink): 52 """ Short link to a failure reason. """ 53 def __init__(self, idFailureReason, sName = WuiContentBase.ksShortDetailsLink, sTitle = None, fBracketed = None): 54 if fBracketed is None: 55 fBracketed = len(sName) > 2; 56 from testmanager.webui.wuiadmin import WuiAdmin; 57 WuiTmLink.__init__(self, sName = sName, 58 sUrlBase = WuiAdmin.ksScriptName, 59 dParams = { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonDetails, 60 FailureReasonData.ksParam_idFailureReason: idFailureReason, }, 61 fBracketed = fBracketed); 62 self.idFailureReason = idFailureReason; 63 64 class WuiFailureReasonAddLink(WuiTmLink): 65 """ Link for adding a failure reason. """ 66 def __init__(self, sName = WuiContentBase.ksShortAddLink, sTitle = None, fBracketed = None): 67 if fBracketed is None: 68 fBracketed = len(sName) > 2; 69 from testmanager.webui.wuiadmin import WuiAdmin; 70 WuiTmLink.__init__(self, sName = sName, 71 sUrlBase = WuiAdmin.ksScriptName, 72 dParams = { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureReasonAdd, }, 73 fBracketed = fBracketed); 49 74 50 75 … … 373 398 sOnSubmit = WuiHlpForm.ksOnSubmit_AddReturnToFieldWithCurrentUrl); 374 399 oForm.addTextHidden(TestResultFailureData.ksParam_idTestResult, oTestResultTree.idTestResult); 375 oForm.addComboBox(TestResultFailureData.ksParam_idFailureReason, oData.idFailureReason if oData is not None else -1,376 'Reason', aoFailureReasons);377 oForm.addMultilineText(TestResultFailureData.ksParam_sComment,378 oData.sComment if oData is not None else '', 'Comment');379 400 if oData is not None: 380 oForm.addNonText('%s (%s)' % (oData.oAuthor.sUsername, oData.oAuthor.sUsername), 'Sheriff'); 381 oForm.addNonText(oData.tsEffective, 'When'); 401 oForm.addComboBox(TestResultFailureData.ksParam_idFailureReason, oData.idFailureReason, 'Reason', 402 aoFailureReasons, 403 sPostHtml = WuiFailureReasonDetailsLink(oData.idFailureReason).toHtml()); 404 oForm.addMultilineText(TestResultFailureData.ksParam_sComment, oData.sComment, 'Comment') 405 406 oForm.addNonText('%s (%s), %s' % (oData.oAuthor.sUsername, oData.oAuthor.sUsername, self.formatTsShort(oData.tsEffective)), 'Sheriff'); 382 407 oForm.addTextHidden(TestResultFailureData.ksParam_tsEffective, oData.tsEffective); 383 408 oForm.addTextHidden(TestResultFailureData.ksParam_tsExpire, oData.tsExpire); 384 409 oForm.addTextHidden(TestResultFailureData.ksParam_uidAuthor, oData.uidAuthor); 385 410 else: 411 oForm.addComboBox(TestResultFailureData.ksParam_idFailureReason, -1, 'Reason', aoFailureReasons, 412 sPostHtml = ' ' + WuiFailureReasonAddLink('New').toHtml()); 413 oForm.addMultilineText(TestResultFailureData.ksParam_sComment, '', 'Comment'); 386 414 oForm.addTextHidden(TestResultFailureData.ksParam_tsEffective, ''); 387 415 oForm.addTextHidden(TestResultFailureData.ksParam_tsExpire, ''); 388 416 oForm.addTextHidden(TestResultFailureData.ksParam_uidAuthor, ''); 389 417 390 oForm.addSubmit('Change Reason' ,);418 oForm.addSubmit('Change Reason'); 391 419 sHtml += oForm.finalize(); 392 420 return sHtml;
Note:
See TracChangeset
for help on using the changeset viewer.