def _generateResultPeriodSelector(self, dParams, sCurPeriod):
        """
        Generate HTML code for result period selector.
        """

        if self.ksParamEffectivePeriod in dParams:
            del dParams[self.ksParamEffectivePeriod];

        # Forget about page No when changing a period
        if WuiDispatcherBase.ksParamPageNo in dParams:
            del dParams[WuiDispatcherBase.ksParamPageNo]

        sHtmlPeriodSelector  = '<form name="PeriodForm" method="GET">\n'
        sHtmlPeriodSelector += '  Period is\n'
        sHtmlPeriodSelector += '  <select name="%s" onchange="window.location=' % self.ksParamEffectivePeriod
        sHtmlPeriodSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), self.ksParamEffectivePeriod)
        sHtmlPeriodSelector += 'this.options[this.selectedIndex].value;">\n'

        for sPeriodValue, sPeriodCaption, _ in self.kaoResultPeriods:
            sHtmlPeriodSelector += '    <option value="%s"%s>%s</option>\n' \
                                % (webutils.quoteUrl(sPeriodValue),
                                   ' selected="selected"' if sPeriodValue == sCurPeriod else '',
                                   sPeriodCaption)

        sHtmlPeriodSelector += '  </select>\n' \
                               '</form>\n'

        return sHtmlPeriodSelector
    def _generateTimeSelector(self, dParams, sPreamble, sPostamble):
        """
        Generate HTML code for time selector.
        """

        if WuiDispatcherBase.ksParamEffectiveDate in dParams:
            tsEffective = dParams[WuiDispatcherBase.ksParamEffectiveDate]
            del dParams[WuiDispatcherBase.ksParamEffectiveDate]
        else:
            tsEffective = ''

        # Forget about page No when changing a period
        if WuiDispatcherBase.ksParamPageNo in dParams:
            del dParams[WuiDispatcherBase.ksParamPageNo]


        sHtmlTimeSelector  = '<form name="TimeForm" method="GET">\n'
        sHtmlTimeSelector += sPreamble;
        sHtmlTimeSelector += '\n  <select name="%s" onchange="window.location=' % WuiDispatcherBase.ksParamEffectiveDate
        sHtmlTimeSelector += '\'?%s&%s=\' + ' % (webutils.encodeUrlParams(dParams), WuiDispatcherBase.ksParamEffectiveDate)
        sHtmlTimeSelector += 'this.options[this.selectedIndex].value;" title="Effective date">\n'

        aoWayBackPoints = [
            ('+0000-00-00 00:00:00.00', 'Now', ' title="Present Day. Present Time."'), # lain :)

            ('-0000-00-00 01:00:00.00', 'One hour ago', ''),
            ('-0000-00-00 02:00:00.00', 'Two hours ago', ''),
            ('-0000-00-00 03:00:00.00', 'Three hours ago', ''),

            ('-0000-00-01 00:00:00.00', 'One day ago', ''),
            ('-0000-00-02 00:00:00.00', 'Two days ago', ''),
            ('-0000-00-03 00:00:00.00', 'Three days ago', ''),

            ('-0000-00-07 00:00:00.00', 'One week ago', ''),
            ('-0000-00-14 00:00:00.00', 'Two weeks ago', ''),
            ('-0000-00-21 00:00:00.00', 'Three weeks ago', ''),

            ('-0000-01-00 00:00:00.00', 'One month ago', ''),
            ('-0000-02-00 00:00:00.00', 'Two months ago', ''),
            ('-0000-03-00 00:00:00.00', 'Three months ago', ''),
            ('-0000-04-00 00:00:00.00', 'Four months ago', ''),
            ('-0000-05-00 00:00:00.00', 'Five months ago', ''),
            ('-0000-06-00 00:00:00.00', 'Half a year ago', ''),

            ('-0001-00-00 00:00:00.00', 'One year ago', ''),
        ]
        fSelected = False;
        for sTimestamp, sWayBackPointCaption, sExtraAttrs in aoWayBackPoints:
            if sTimestamp == tsEffective:
                fSelected = True;
            sHtmlTimeSelector += '    <option value="%s"%s%s>%s</option>\n' \
                              % (webutils.quoteUrl(sTimestamp),
                                 ' selected="selected"' if sTimestamp == tsEffective else '',
                                 sExtraAttrs, sWayBackPointCaption)
        if not fSelected and tsEffective != '':
            sHtmlTimeSelector += '    <option value="%s" selected>%s</option>\n' \
                              % (webutils.quoteUrl(tsEffective), tsEffective)

        sHtmlTimeSelector += '  </select>\n';
        sHtmlTimeSelector += sPostamble;
        sHtmlTimeSelector += '\n</form>\n'

        return sHtmlTimeSelector