wuiadminglobalrsrc.py revision cf22150eaeeb72431bf1cf65c309a431454fb22b
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# -*- coding: utf-8 -*-
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncTest Manager WUI - Global resources.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCopyright (C) 2012-2014 Oracle Corporation
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThis file is part of VirtualBox Open Source Edition (OSE), as
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncavailable from http://www.virtualbox.org. This file is free software;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncyou can redistribute it and/or modify it under the terms of the GNU
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncGeneral Public License (GPL) as published by the Free Software
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncFoundation, in version 2 as it comes in the "COPYING" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution. VirtualBox OSE is distributed in the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsynchope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncThe contents of this file may alternatively be used under the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncof the Common Development and Distribution License Version 1.0
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync(CDDL) only, as it comes in the "COPYING.CDDL" file of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncVirtualBox OSE distribution, in which case the provisions of the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncCDDL are applicable instead of those of the GPL.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncYou may elect to license modified versions of this file under the
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncterms and conditions of either the GPL or the CDDL or both.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync# Validation Kit imports.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.webui.wuicontentbase import WuiContentBase
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.core.globalresource import GlobalResourceData
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncfrom testmanager.webui.wuicontentbase import WuiListContentBase, WuiTmLink
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WUI global resources content generator.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Do necessary initializations
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def showAddModifyPage(self, sAction, dErrors = None):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync Render add global resource HTML form.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sFormActionUrl = '%s?%s=%s' % (WuiAdmin.ksScriptName,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sFormActionUrl += '&%s=%s' % (GlobalResourceData.ksParam_idGlobalRsrc, self._oData.idGlobalRsrc)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync raise WuiException('Invalid paraemter "%s"' % (sAction,))
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addIntRO (GlobalResourceData.ksParam_idGlobalRsrc, self._oData.idGlobalRsrc, 'Global Resource ID')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addTimestampRO(GlobalResourceData.ksParam_tsEffective, self._oData.tsEffective, 'Last changed')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addTimestampRO(GlobalResourceData.ksParam_tsExpire, self._oData.tsExpire, 'Expires (excl)')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addIntRO (GlobalResourceData.ksParam_uidAuthor, self._oData.uidAuthor, 'Changed by UID')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addText (GlobalResourceData.ksParam_sName, self._oData.sName, 'Name')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addText (GlobalResourceData.ksParam_sDescription, self._oData.sDescription, 'Description')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync oForm.addCheckBox (GlobalResourceData.ksParam_fEnabled, self._oData.fEnabled, 'Enabled')
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WUI Content Generator.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync def __init__(self, aoEntries, iPage, cItemsPerPage, tsEffective, fnDPrint, oDisp):
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sTitle = 'Global Resources', sId = 'globalResources',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self._asColumnHeaders = ['ID', 'Name', 'Description', 'Enabled', 'Actions' ]
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync self._asColumnAttribs = ['align="right"', 'align="center"', 'align="center"',
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionGlobalRsrcShowEdit,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync GlobalResourceData.ksParam_idGlobalRsrc: oEntry.idGlobalRsrc }),
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync { WuiAdmin.ksParamAction: WuiAdmin.ksActionGlobalRsrcDel,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync GlobalResourceData.ksParam_idGlobalRsrc: oEntry.idGlobalRsrc },
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync sConfirm = 'Are you sure you want to remove global resource #%d?' % (oEntry.idGlobalRsrc,)),