VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuifailurecategory.py@ 61184

Last change on this file since 61184 was 56295, checked in by vboxsync, 10 years ago

ValidationKit: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuifailurecategory.py 56295 2015-06-09 14:29:55Z vboxsync $
3
4"""
5Test Manager WUI - Failure Categories Web content generator.
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2015 Oracle Corporation
11
12This file is part of VirtualBox Open Source Edition (OSE), as
13available from http://www.virtualbox.org. This file is free software;
14you can redistribute it and/or modify it under the terms of the GNU
15General Public License (GPL) as published by the Free Software
16Foundation, in version 2 as it comes in the "COPYING" file of the
17VirtualBox OSE distribution. VirtualBox OSE is distributed in the
18hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
19
20The contents of this file may alternatively be used under the terms
21of the Common Development and Distribution License Version 1.0
22(CDDL) only, as it comes in the "COPYING.CDDL" file of the
23VirtualBox OSE distribution, in which case the provisions of the
24CDDL are applicable instead of those of the GPL.
25
26You may elect to license modified versions of this file under the
27terms and conditions of either the GPL or the CDDL or both.
28"""
29__version__ = "$Revision: 56295 $"
30
31
32# Validation Kit imports.
33from testmanager.webui.wuicontentbase import WuiFormContentBase, WuiListContentBase, WuiTmLink
34from testmanager.core.failurecategory import FailureCategoryData
35from testmanager.webui.wuibase import WuiException
36
37
38class WuiFailureCategory(WuiFormContentBase):
39 """
40 WUI Failure Category HTML content generator.
41 """
42
43 def __init__(self, oFailureCategoryData, sMode, oDisp):
44 """
45 Prepare & initialize parent
46 """
47
48 if sMode == WuiFormContentBase.ksMode_Add:
49 sTitle = 'Add Failure Category'
50 sSubmitAction = oDisp.ksActionFailureCategoryAdd
51 elif sMode == WuiFormContentBase.ksMode_Edit:
52 sTitle = 'Edit Failure Category'
53 sSubmitAction = oDisp.ksActionFailureCategoryEdit
54 else:
55 raise WuiException('Unknown parameter')
56
57 WuiFormContentBase.__init__(self, oFailureCategoryData, sMode, 'FailureCategory', oDisp, sTitle,
58 sSubmitAction = sSubmitAction, fEditable = False); ## @todo non-standard action names.
59
60 def _populateForm(self, oForm, oData):
61 """
62 Construct an HTML form
63 """
64
65 oForm.addIntRO (FailureCategoryData.ksParam_idFailureCategory, oData.idFailureCategory, 'Failure Category ID')
66 oForm.addTimestampRO(FailureCategoryData.ksParam_tsEffective, oData.tsEffective, 'Last changed')
67 oForm.addTimestampRO(FailureCategoryData.ksParam_tsExpire, oData.tsExpire, 'Expires (excl)')
68 oForm.addIntRO (FailureCategoryData.ksParam_uidAuthor, oData.uidAuthor, 'Changed by UID')
69 oForm.addText (FailureCategoryData.ksParam_sShort, oData.sShort, 'Short Description')
70 oForm.addText (FailureCategoryData.ksParam_sFull, oData.sFull, 'Full Description')
71
72 oForm.addSubmit()
73
74 return True
75
76class WuiFailureCategoryList(WuiListContentBase):
77 """
78 WUI Admin Failure Category Content Generator.
79 """
80
81 def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
82 WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
83 sTitle = 'Failure Categories', sId = 'failureCategories',
84 fnDPrint = fnDPrint, oDisp = oDisp);
85
86 self._asColumnHeaders = ['ID', 'Short Description', 'Full Description', 'Actions' ]
87 self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"', 'align="center"']
88
89 def _formatListEntry(self, iEntry):
90 from testmanager.webui.wuiadmin import WuiAdmin
91 oEntry = self._aoEntries[iEntry]
92
93 return [ oEntry.idFailureCategory,
94 oEntry.sShort,
95 oEntry.sFull,
96 [ WuiTmLink('Modify', WuiAdmin.ksScriptName,
97 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryShowEdit,
98 FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory }),
99 WuiTmLink('Remove', WuiAdmin.ksScriptName,
100 { WuiAdmin.ksParamAction: WuiAdmin.ksActionFailureCategoryDel,
101 FailureCategoryData.ksParam_idFailureCategory: oEntry.idFailureCategory },
102 sConfirm = 'Do you really want to remove failure cateogry #%d?' % (oEntry.idFailureCategory,)),
103 ] ];
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette