VirtualBox

Changeset 61472 in vbox for trunk


Ignore:
Timestamp:
Jun 5, 2016 5:46:15 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
107799
Message:

testmanager: adding sComment columns to TestCases, TestGroups and SchedGroups.

Location:
trunk/src/VBox/ValidationKit/testmanager
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/testmanager/core/globalresource.py

    r61220 r61472  
    7373    def initFromDbRow(self, aoRow):
    7474        """
    75         Reinitialize from a SELECT * FROM TestCases row.
     75        Reinitialize from a SELECT * FROM GlobalResources row.
    7676        Returns self. Raises exception if no row.
    7777        """
  • trunk/src/VBox/ValidationKit/testmanager/core/schedgroup.py

    r61468 r61472  
    6565    kiMax_iSchedPriority        = 32;
    6666
     67    kcDbColumns                 = 8
    6768
    6869    def __init__(self):
     
    125126        """
    126127        SchedGroupMemberData.initFromDbRow(self, aoRow);
    127         self.oTestGroup = TestGroupData().initFromDbRow(aoRow[8:]);
     128        self.oTestGroup = TestGroupData().initFromDbRow(aoRow[SchedGroupMemberData.kcDbColumns:]);
    128129        return self;
    129130
     
    170171    ksParam_idBuildSrc          = 'SchedGroup_idBuildSrc';
    171172    ksParam_idBuildSrcTestSuite = 'SchedGroup_idBuildSrcTestSuite';
     173    ksParam_sComment            = 'SchedGroup_sComment';
    172174
    173175    kasAllowNullAttributes      = ['idSchedGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription',
    174                                    'idBuildSrc', 'idBuildSrcTestSuite'];
     176                                   'idBuildSrc', 'idBuildSrcTestSuite', 'sComment' ];
    175177    kasValidValues_enmScheduler = [ksScheduler_BestEffortContinousItegration, ];
     178
     179    kcDbColumns                 = 11;
    176180
    177181    # Scheduler types
     
    197201        self.enmScheduler            = SchedGroupData.ksScheduler_BestEffortContinousItegration;
    198202        self.idBuildSrc              = None;
    199         self.idBuildSrcTestSuite = None;
     203        self.idBuildSrcTestSuite     = None;
     204        self.sComment                = None;
    200205
    201206    def initFromDbRow(self, aoRow):
     
    218223        self.enmScheduler            = aoRow[7];
    219224        self.idBuildSrc              = aoRow[8];
    220         self.idBuildSrcTestSuite = aoRow[9];
     225        self.idBuildSrcTestSuite     = aoRow[9];
     226        self.sComment                = aoRow[10];
    221227        return self;
    222228
     
    496502                          '         enmScheduler,\n'
    497503                          '         idBuildSrc,\n'
    498                           '         idBuildSrcTestSuite)\n'
    499                           'VALUES (%s, %s, %s, %s, %s, %s, %s)\n'
     504                          '         idBuildSrcTestSuite,\n'
     505                          '         sComment)\n'
     506                          'VALUES (%s, %s, %s, %s, %s, %s, %s, %s)\n'
    500507                          'RETURNING idSchedGroup\n'
    501                           , (uidAuthor,
    502                              oData.sName,
    503                              oData.sDescription,
    504                              oData.fEnabled,
    505                              oData.enmScheduler,
    506                              oData.idBuildSrc,
    507                              oData.idBuildSrcTestSuite));
     508                          , ( uidAuthor,
     509                              oData.sName,
     510                              oData.sDescription,
     511                              oData.fEnabled,
     512                              oData.enmScheduler,
     513                              oData.idBuildSrc,
     514                              oData.idBuildSrcTestSuite,
     515                              oData.sComment ));
    508516        idSchedGroup = self._oDb.fetchOne()[0];
    509517        oData.idSchedGroup = idSchedGroup;
     
    803811    def exists(self, sName):
    804812        """Checks if a group with the given name exists."""
    805         self._oDb.execute('SELECT *\n'
     813        self._oDb.execute('SELECT idSchedGroup\n'
    806814                          'FROM   SchedGroups\n'
    807815                          'WHERE  tsExpire   = \'infinity\'::TIMESTAMP\n'
    808                           '   AND sName = %s\n'
     816                          '   AND sName      = %s\n'
     817                          'LIMIT 1\n'
    809818                          , (sName,));
    810819        return self._oDb.getRowCount() > 0;
     
    814823        self._oDb.execute('SELECT   *\n'
    815824                          'FROM     SchedGroups\n'
    816                           'WHERE    tsExpire   = \'infinity\'::timestamp\n'
     825                          'WHERE    tsExpire     = \'infinity\'::timestamp\n'
    817826                          '  AND    idSchedGroup = %s;', (idSchedGroup,))
    818827        aRows = self._oDb.fetchAll()
     
    825834            return None
    826835
    827     def remove(self, uidAuthor, idScedGroup, fNeedCommit=True):
    828         """Historize Scheduling Group record"""
    829         self._oDb.execute('UPDATE SchedGroups\n'
    830                           'SET    tsExpire     = CURRENT_TIMESTAMP,\n'
    831                           '       uidAuthor    = %s\n'
    832                           'WHERE  idSchedGroup = %s\n'
    833                           '   AND tsExpire     = \'infinity\'::TIMESTAMP\n',
    834                           (uidAuthor, idScedGroup))
    835         if fNeedCommit:
    836             self._oDb.commit()
    837         return True
    838836
    839837    #
     
    878876                          '         enmScheduler,\n'
    879877                          '         idBuildSrc,\n'
    880                           '         idBuildSrcTestSuite )\n'
    881                           'VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )\n'
     878                          '         idBuildSrcTestSuite,\n'
     879                          '         sComment )\n'
     880                          'VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )\n'
    882881                          , ( uidAuthor,
    883882                              tsEffective,
     
    888887                              oData.enmScheduler,
    889888                              oData.idBuildSrc,
    890                               oData.idBuildSrcTestSuite, ));
     889                              oData.idBuildSrcTestSuite,
     890                              oData.sComment, ));
    891891        return True;
    892892
  • trunk/src/VBox/ValidationKit/testmanager/core/testcase.pgsql

    r61468 r61472  
    3232DROP FUNCTION IF EXISTS del_testcase(INTEGER);
    3333DROP FUNCTION IF EXISTS TestCaseLogic_delEntry(INTEGER, INTEGER);
     34DROP FUNCTION IF EXISTS TestCaseLogic_addEntry(a_uidAuthor INTEGER, a_sName TEXT, a_sDescription TEXT,
     35                                               a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT,
     36                                               a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT);
     37DROP FUNCTION IF EXISTS TestCaseLogic_editEntry(a_uidAuthor INTEGER, a_idTestCase INTEGER, a_sName TEXT, a_sDescription TEXT,
     38                                                a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT,
     39                                                a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT);
    3440
    3541---
     
    96102$$ LANGUAGE plpgsql;
    97103
     104
    98105CREATE OR REPLACE function TestCaseLogic_addEntry(a_uidAuthor INTEGER, a_sName TEXT, a_sDescription TEXT,
    99106                                                  a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT,
    100                                                   a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT)
     107                                                  a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT,
     108                                                  a_sComment TEXT)
    101109    RETURNS INTEGER AS $$
    102110    DECLARE
     
    106114
    107115        INSERT INTO TestCases (uidAuthor, sName, sDescription, fEnabled, cSecTimeout,
    108                                sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips)
     116                               sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips, sComment)
    109117            VALUES (a_uidAuthor, a_sName, a_sDescription, a_fEnabled, a_cSecTimeout,
    110                     a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips)
     118                    a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips, a_Comment)
    111119            RETURNING idTestcase INTO v_idTestCase;
    112120        RETURN v_idTestCase;
     
    114122$$ LANGUAGE plpgsql;
    115123
     124
    116125CREATE OR REPLACE function TestCaseLogic_editEntry(a_uidAuthor INTEGER, a_idTestCase INTEGER, a_sName TEXT, a_sDescription TEXT,
    117126                                                   a_fEnabled BOOL, a_cSecTimeout INTEGER,  a_sTestBoxReqExpr TEXT,
    118                                                    a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT)
     127                                                   a_sBuildReqExpr TEXT, a_sBaseCmd TEXT, a_sTestSuiteZips TEXT,
     128                                                   a_sComment TEXT)
    119129    RETURNS INTEGER AS $$
    120130    DECLARE
     
    126136        PERFORM TestCaseLogic_historizeEntry(a_idTestCase, CURRENT_TIMESTAMP);
    127137        INSERT INTO TestCases (idTestCase, uidAuthor, sName, sDescription, fEnabled, cSecTimeout,
    128                                sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips)
     138                               sTestBoxReqExpr, sBuildReqExpr, sBaseCmd, sTestSuiteZips, sComment)
    129139            VALUES (a_idTestCase, a_uidAuthor, a_sName, a_sDescription, a_fEnabled, a_cSecTimeout,
    130                     a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips)
     140                    a_sTestBoxReqExpr, a_sBuildReqExpr, a_sBaseCmd, a_sTestSuiteZips, a_sComment)
    131141            RETURNING idGenTestCase INTO v_idGenTestCase;
    132142       RETURN v_idGenTestCase;
  • trunk/src/VBox/ValidationKit/testmanager/core/testcase.py

    r61468 r61472  
    438438    ksParam_sBaseCmd        = 'TestCase_sBaseCmd'
    439439    ksParam_sValidationKitZips = 'TestCase_sValidationKitZips'
     440    ksParam_sComment        = 'TestCase_sComment'
    440441
    441442    kasAllowNullAttributes  = [ 'idTestCase', 'tsEffective', 'tsExpire', 'uidAuthor', 'idGenTestCase', 'sDescription',
    442                                 'sTestBoxReqExpr', 'sBuildReqExpr', 'sValidationKitZips', ];
    443 
     443                                'sTestBoxReqExpr', 'sBuildReqExpr', 'sValidationKitZips', 'sComment' ];
     444
     445    kcDbColumns             = 14;
    444446
    445447    def __init__(self):
     
    463465        self.sBaseCmd           = None;
    464466        self.sValidationKitZips = None;
     467        self.sComment           = None;
    465468
    466469    def initFromDbRow(self, aoRow):
     
    485488        self.sBaseCmd           = aoRow[11];
    486489        self.sValidationKitZips = aoRow[12];
     490        self.sComment           = aoRow[13];
    487491        return self;
    488492
     
    11481152        self._oDb.callProc('TestCaseLogic_addEntry',
    11491153                           ( uidAuthor, oData.sName, oData.sDescription, oData.fEnabled, oData.cSecTimeout,
    1150                              oData.sTestBoxReqExpr, oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips ));
     1154                             oData.sTestBoxReqExpr, oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips,
     1155                             oData.sComment ));
    11511156        oData.idTestCase = self._oDb.fetchOne()[0];
    11521157
     
    12031208            self._oDb.callProc('TestCaseLogic_editEntry', ( uidAuthor, oData.idTestCase, oData.sName, oData.sDescription,
    12041209                                                            oData.fEnabled, oData.cSecTimeout, oData.sTestBoxReqExpr,
    1205                                                             oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips ));
     1210                                                            oData.sBuildReqExpr, oData.sBaseCmd, oData.sValidationKitZips,
     1211                                                            oData.sComment ));
    12061212            oData.idGenTestCase = self._oDb.fetchOne()[0];
    12071213
  • trunk/src/VBox/ValidationKit/testmanager/core/testgroup.py

    r61220 r61472  
    5454    kiMax_iSchedPriority        = 31;
    5555
     56    kcDbColumns                 = 7;
    5657
    5758    def __init__(self):
     
    133134        TestGroupMemberData.initFromDbRow(self, aoRow);
    134135        self.oTestCase = TestCaseDataEx();
    135         self.oTestCase.initFromDbRowEx(aoRow[7:], oDb, tsNow);
     136        self.oTestCase.initFromDbRowEx(aoRow[TestGroupMemberData.kcDbColumns:], oDb, tsNow);
    136137        return self;
    137138
     
    168169    def initFromDbRowEx(self, aoRow):
    169170        """
    170         Reinitialize from a :WRONG QUERY:
    171 
    172             SELECT TestCases.idTestCase,
    173                    TestGroupMembers.tsEffective,
    174                    TestGroupMembers.tsExpire,
    175                    TestGroupMembers.uidAuthor,
    176                    TestCases.idGenTestCase,
    177                    TestCases.sName,
    178                    TestCases.sDescription,
    179                    TestCases.fEnabled,
    180                    TestCases.cSecTimeout,
    181                    TestCases.sBaseCmd,
    182                    TestCases.sValidationKitZips,
     171        Reinitialize from this query:
     172
     173            SELECT TestCases.*,
    183174                   TestGroupMembers.idTestGroup,
    184175                   TestGroupMembers.aidTestCaseArgs
     
    186177            WHERE TestCases.idTestCase = TestGroupMembers.idTestCase
    187178
    188         ..row. Represents complete test group member (test case) info.
     179        Represents complete test group member (test case) info.
    189180        Returns object of type TestGroupMemberData2. Raises exception if no row.
    190181        """
     
    208199    ksParam_sName           = 'TestGroup_sName'
    209200    ksParam_sDescription    = 'TestGroup_sDescription'
    210 
    211     kasAllowNullAttributes      = ['idTestGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription' ];
     201    ksParam_sComment        = 'TestGroup_sComment'
     202
     203    kasAllowNullAttributes      = ['idTestGroup', 'tsEffective', 'tsExpire', 'uidAuthor', 'sDescription', 'sComment' ];
     204
     205    kcDbColumns             = 7;
    212206
    213207    def __init__(self):
     
    224218        self.sName           = None
    225219        self.sDescription    = None
     220        self.sComment        = None
    226221
    227222    def initFromDbRow(self, aoRow):
     
    239234        self.sName           = aoRow[4]
    240235        self.sDescription    = aoRow[5]
     236        self.sComment        = aoRow[6]
    241237        return self
    242238
     
    425421        # Do the job.
    426422        #
    427         self._oDb.execute('INSERT INTO TestGroups (uidAuthor, sName, sDescription)\n'
     423        self._oDb.execute('INSERT INTO TestGroups (uidAuthor, sName, sDescription, sComment)\n'
    428424                          'VALUES (%s, %s, %s)\n'
    429425                          'RETURNING idTestGroup\n'
    430426                          , ( uidAuthor,
    431427                              oData.sName,
    432                               oData.sDescription,));
     428                              oData.sDescription,
     429                              oData.sComment, ));
    433430        idTestGroup = self._oDb.fetchOne()[0];
    434431        oData.idTestGroup = idTestGroup;
     
    464461            self._historizeTestGroup(oData.idTestGroup);
    465462            self._oDb.execute('INSERT INTO TestGroups\n'
    466                               '       (uidAuthor, idTestGroup, sName, sDescription)\n'
    467                               'VALUES (%s, %s, %s, %s)\n'
     463                              '       (uidAuthor, idTestGroup, sName, sDescription, sComment)\n'
     464                              'VALUES (%s, %s, %s, %s, %s)\n'
    468465                              , ( uidAuthor,
    469466                                  oData.idTestGroup,
    470467                                  oData.sName,
    471                                   oData.sDescription, ));
     468                                  oData.sDescription,
     469                                  oData.sComment ));
    472470
    473471        # Create a lookup dictionary for old entries.
     
    634632                              'WHERE    tsExpire     = \'infinity\'::timestamp\n'
    635633                              '  AND    idTestGroup  = %s\n'
    636                               'ORDER BY idTestGroup ASC;', (idTestGroup,))
     634                              'ORDER BY idTestGroup ASC;'
     635                              , (idTestGroup,))
    637636        else:
    638637            self._oDb.execute('SELECT   *\n'
     
    641640                              '  AND    tsEffective <= %s\n'
    642641                              '  AND    idTestGroup  = %s\n'
    643                               'ORDER BY idTestGroup ASC;',
    644                               (tsNow, tsNow, idTestGroup))
     642                              'ORDER BY idTestGroup ASC;'
     643                              , (tsNow, tsNow, idTestGroup))
    645644
    646645        aRows = self._oDb.fetchAll()
  • trunk/src/VBox/ValidationKit/testmanager/db/TestManagerDatabaseInit.pgsql

    r61468 r61472  
    301301    -- @DOWNLOAD_BASE_URL@ prefix can be used to refer to this area.
    302302    sTestSuiteZips      TEXT        DEFAULT NULL,
     303
     304    -- Comment regarding a change or something.
     305    sComment            TEXT        DEFAULT NULL,
    303306
    304307    PRIMARY KEY (idTestCase, tsExpire)
     
    511514
    512515    --- The name of the scheduling group.
    513     sName               text        NOT NULL,
     516    sName               TEXT        NOT NULL,
    514517    --- Optional group description.
    515     sDescription        text,
     518    sDescription        TEXT,
     519    -- Comment regarding a change or something.
     520    sComment            TEXT        DEFAULT NULL,
    516521
    517522    PRIMARY KEY (idTestGroup, tsExpire)
     
    604609
    605610    --- The name of the scheduling group.
    606     sName               text        NOT NULL,
     611    sName               TEXT        NOT NULL,
    607612    --- Optional group description.
    608     sDescription        text,
     613    sDescription        TEXT,
    609614    --- Indicates whether this group is currently enabled.
    610615    fEnabled            boolean     NOT NULL,
     
    619624    -- Non-unique foreign key: BuildSources(idBuildSrc)
    620625    idBuildSrcTestSuite INTEGER     DEFAULT NULL,
     626    -- Comment regarding a change or something.
     627    sComment            TEXT        DEFAULT NULL,
    621628
    622629    PRIMARY KEY (idSchedGroup, tsExpire)
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminschedgroup.py

    r56295 r61472  
    8484                                         fReadOnly = self._sMode == WuiFormContentBase.ksMode_Show);
    8585
     86        oForm.addMultilineText  (SchedGroupData.ksParam_sComment,     oData.sComment,         'Comment');
    8687        oForm.addSubmit()
    8788
     
    100101        self._asColumnHeaders = [
    101102            'ID',  'Name', 'Enabled', 'Scheduler Type',
    102             'Build Source', 'Validation Kit Source', 'Test Groups', 'TestBoxes', 'Actions',
     103            'Build Source', 'Validation Kit Source', 'Test Groups', 'TestBoxes', 'Note', 'Actions',
    103104        ];
    104105
    105106        self._asColumnAttribs = [
    106107            'align="right"', 'align="center"', 'align="center"', 'align="center"',
    107             'align="center"', 'align="center"', '', '', 'align="center"',
     108            'align="center"', 'align="center"', '', '', 'align="center"', 'align="center"',
    108109        ];
    109110
     
    181182            aoMembers,
    182183            aoTestBoxes,
     184            self._formatCommentCell(oEntry.sComment),
    183185            aoActions,
    184186        ];
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestbox.py

    r61468 r61472  
    235235                                   fBracketed = False);
    236236        # Comment
    237         oComment = None;
    238         if oEntry.sComment is not None:
    239             sComment = oEntry.sComment.strip();
    240             if len(sComment) > 64:
    241                 oComment = WuiRawHtml('<span title="%s">%s...</span>'
    242                                       % (webutils.escapeAttr(sComment), webutils.escapeElem(sComment[:60]),));
    243             elif len(sComment) > 0:
    244                 oComment = WuiRawHtml(webutils.escapeElem(sComment));
     237        oComment = self._formatCommentCell(oEntry.sComment);
    245238
    246239        # Group link.
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestcase.py

    r61272 r61472  
    6464        self._asColumnHeaders = \
    6565        [
    66             'Name', 'Active', 'Default Timeout', 'Base Command / Variations', 'Validation Kit Files',
    67             'Test Case Prereqs', 'Global Resources', 'Actions'
     66            'Name', 'Active', 'Timeout', 'Base Command / Variations', 'Validation Kit Files',
     67            'Test Case Prereqs', 'Global Rsrces', 'Note', 'Actions'
    6868        ];
    6969        self._asColumnAttribs = \
    7070        [
    71             '', '', '', '', '',
    72             'valign="top"', 'valign="top"', 'align="center"'
     71            '', '', 'align="center"', '', '',
     72            'valign="top"', 'valign="top"', 'align="center"', 'align="center"'
    7373        ];
    7474
     
    154154        aoRet.append(WuiRawHtml(sHtml));
    155155
     156        # Comment (note).
     157        aoRet.append(self._formatCommentCell(oEntry.sComment));
     158
    156159        # Show actions that can be taken.
    157160        aoActions = [ WuiTmLink('Details', WuiAdmin.ksScriptName,
     
    237240        oForm.addListOfResources(TestCaseDataEx.ksParam_aoDepGlobalResources, aoGlobalResrcDeps, 'Depends on resources')
    238241
     242        oForm.addMultilineText(TestCaseDataEx.ksParam_sComment, oData.sComment, 'Comment');
     243
    239244        oForm.addSubmit();
    240245
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmintestgroup.py

    r56295 r61472  
    7474                                        fReadOnly = self._sMode == WuiFormContentBase.ksMode_Show);
    7575
     76        oForm.addMultilineText  (TestGroupData.ksParam_sComment,         self._oData.sComment,       'Comment');
    7677        oForm.addSubmit();
    7778        return True;
     
    8889        WuiListContentBase.__init__(self, aoEntries, iPage, cItemsPerPage, tsEffective,
    8990                                    sTitle = 'Test Groups', fnDPrint = fnDPrint, oDisp = oDisp);
    90         self._asColumnHeaders = [ 'ID', 'Name', 'Description', 'Test Cases', 'Actions' ];
    91         self._asColumnAttribs = [ 'align="right"', '', '', '', 'align="center"' ];
     91        self._asColumnHeaders = [ 'ID', 'Name', 'Description', 'Test Cases', 'Note', 'Actions' ];
     92        self._asColumnAttribs = [ 'align="right"', '', '', '', 'align="center"', 'align="center"' ];
    9293
    9394
     
    178179                 oEntry.sDescription if oEntry.sDescription is not None else '',
    179180                 oTestCases,
     181                 self._formatCommentCell(oEntry.sComment, cMaxLines = max(3, len(oEntry.aoMembers) * 2)),
    180182                 aoActions ];
    181183
  • trunk/src/VBox/ValidationKit/testmanager/webui/wuicontentbase.py

    r61424 r61472  
    203203    Outputs the given text within a span of the given CSS class.
    204204    """
    205     def __init__(self, sSpanClass, sText):
    206         WuiRawHtml.__init__(self,
    207                             u'<span class="%s">%s</span>'
    208                             % (webutils.escapeAttr(sSpanClass), webutils.escapeElem(sText),));
     205    def __init__(self, sSpanClass, sText, sTitle = None):
     206        if sTitle is None:
     207            WuiRawHtml.__init__(self,
     208                                u'<span class="%s">%s</span>'
     209                                % ( webutils.escapeAttr(sSpanClass),  webutils.escapeElem(sText),));
     210        else:
     211            WuiRawHtml.__init__(self,
     212                                u'<span class="%s" title="%s">%s</span>'
     213                                % ( webutils.escapeAttr(sSpanClass), webutils.escapeAttr(sTitle), webutils.escapeElem(sText),));
     214
    209215
    210216
     
    692698        self._asColumnAttribs   = [];
    693699
     700    def _formatCommentCell(self, sComment, cMaxLines = 3, cchMaxLine = 63):
     701        """
     702        Helper functions for formatting comment cell.
     703        Returns None or WuiRawHtml instance.
     704        """
     705        # Nothing to do for empty comments.
     706        if sComment is None:
     707            return None;
     708        sComment = sComment.strip();
     709        if len(sComment) == 0:
     710            return None;
     711
     712        # Restrict the text if necessary, making the whole text available thru mouse-over.
     713        ## @todo this would be better done by java script or smth, so it could automatically adjust to the table size.
     714        if len(sComment) > cchMaxLine or sComment.count('\n') >= cMaxLines:
     715            sShortHtml = '';
     716            for iLine, sLine in enumerate(sComment.split('\n')):
     717                if iLine >= cMaxLines:
     718                    break;
     719                if iLine > 0:
     720                    sShortHtml += '<br>\n';
     721                if len(sLine) > cchMaxLine:
     722                    sShortHtml += webutils.escapeElem(sLine[:(cchMaxLine - 3)]);
     723                    sShortHtml += '...';
     724                else:
     725                    sShortHtml += webutils.escapeElem(sLine);
     726            return WuiRawHtml('<span class="tmcomment" title="%s">%s</span>' % (webutils.escapeAttr(sComment), sShortHtml,));
     727
     728        return WuiRawHtml('<span class="tmcomment">%s</span>' % (webutils.escapeElem(sComment).replace('\n', '<br>'),));
     729
    694730    def _formatListEntry(self, iEntry):
    695731        """
Note: See TracChangeset for help on using the changeset viewer.

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