VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/testmanager/webui/wuivcshistory.py

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1# -*- coding: utf-8 -*-
2# $Id: wuivcshistory.py 106061 2024-09-16 14:03:52Z vboxsync $
3
4"""
5Test Manager WUI - VCS history
6"""
7
8__copyright__ = \
9"""
10Copyright (C) 2012-2024 Oracle and/or its affiliates.
11
12This file is part of VirtualBox base platform packages, as
13available from https://www.virtualbox.org.
14
15This program is free software; you can redistribute it and/or
16modify it under the terms of the GNU General Public License
17as published by the Free Software Foundation, in version 3 of the
18License.
19
20This program is distributed in the hope that it will be useful, but
21WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23General Public License for more details.
24
25You should have received a copy of the GNU General Public License
26along with this program; if not, see <https://www.gnu.org/licenses>.
27
28The contents of this file may alternatively be used under the terms
29of the Common Development and Distribution License Version 1.0
30(CDDL), a copy of it is provided in the "COPYING.CDDL" file included
31in the VirtualBox distribution, in which case the provisions of the
32CDDL are applicable instead of those of the GPL.
33
34You may elect to license modified versions of this file under the
35terms and conditions of either the GPL or the CDDL or both.
36
37SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
38"""
39__version__ = "$Revision: 106061 $"
40
41# Python imports.
42#import datetime;
43
44# Validation Kit imports.
45from testmanager import config;
46from testmanager.core import db;
47from testmanager.webui.wuicontentbase import WuiContentBase;
48from common import webutils;
49
50class WuiVcsHistoryTooltip(WuiContentBase):
51 """
52 WUI VCS history tooltip generator.
53 """
54
55 def __init__(self, aoEntries, sRepository, iRevision, cEntries, fnDPrint, oDisp):
56 """Override initialization"""
57 WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp);
58 self.aoEntries = aoEntries;
59 self.sRepository = sRepository;
60 self.iRevision = iRevision;
61 self.cEntries = cEntries;
62
63
64 def show(self):
65 """
66 Generates the tooltip.
67 Returns (sTitle, HTML).
68 """
69 sHtml = '<div class="tmvcstimeline tmvcstimelinetooltip">\n';
70
71 oCurDate = None;
72 for oEntry in self.aoEntries:
73 oTsZulu = db.dbTimestampToZuluDatetime(oEntry.tsCreated);
74 if oCurDate is None or oCurDate != oTsZulu.date():
75 if oCurDate is not None:
76 sHtml += ' </dl>\n'
77 oCurDate = oTsZulu.date();
78 sHtml += ' <h2>%s:</h2>\n' \
79 ' <dl>\n' \
80 % (oTsZulu.strftime('%Y-%m-%d'),);
81
82 sEntry = ' <dt id="r%s">' % (oEntry.iRevision, );
83 sEntry += '<a href="%s" target="_blank">' \
84 % ( webutils.escapeAttr(config.g_ksTracChangsetUrlFmt
85 % { 'iRevision': oEntry.iRevision, 'sRepository': oEntry.sRepository,}), );
86
87 sEntry += '<span class="tmvcstimeline-time">%s</span>' % ( oTsZulu.strftime('%H:%MZ'), );
88 sEntry += ' Changeset <span class="tmvcstimeline-rev">[%s]</span>' % ( oEntry.iRevision, );
89 sEntry += ' by <span class="tmvcstimeline-author">%s</span>' % ( webutils.escapeElem(oEntry.sAuthor), );
90 sEntry += '</a>\n';
91 sEntry += '</dt>\n';
92 sEntry += ' <dd>%s</dd>\n' % ( webutils.escapeElem(oEntry.sMessage), );
93
94 sHtml += sEntry;
95
96 if oCurDate is not None:
97 sHtml += ' </dl>\n';
98 sHtml += '</div>\n';
99
100 return ('VCS History Tooltip', sHtml);
101
Note: See TracBrowser for help on using the repository browser.

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