~ubuntu-branches/ubuntu/maverick/vdr-plugin-live/maverick

« back to all changes in this revision

Viewing changes to pages/searchresults.ecpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Schmidt
  • Date: 2007-07-02 21:02:17 UTC
  • Revision ID: james.westby@ubuntu.com-20070702210217-d34t69xf1qosqgvc
Tags: upstream-0.1.0
ImportĀ upstreamĀ versionĀ 0.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<%pre>
 
2
#include <vdr/channels.h>
 
3
#include <vdr/i18n.h>
 
4
#include <vdr/epg.h>
 
5
#include "epgsearch.h"
 
6
#include "tools.h"
 
7
#include "setup.h"
 
8
#include "epg_events.h"
 
9
 
 
10
using namespace vdrlive;
 
11
using namespace std;
 
12
 
 
13
</%pre>
 
14
<%args>
 
15
        // input parameters
 
16
        string searchtimerid;
 
17
        string searchtimerquery;
 
18
        string searchplain;
 
19
</%args>
 
20
<%session scope="global">
 
21
bool logged_in(false);
 
22
</%session>
 
23
<%include>page_init.eh</%include>
 
24
<{
 
25
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
 
26
}>
 
27
<%cpp>
 
28
        pageTitle = tr("Search results");
 
29
        SearchResults results;
 
30
        if (!searchtimerid.empty())
 
31
                results.GetByID(lexical_cast< int >(searchtimerid));
 
32
        if (!searchtimerquery.empty())
 
33
                results.GetByQuery(SearchResults::PopQuery(searchtimerquery));
 
34
        if (!searchplain.empty())
 
35
        {
 
36
                string query = searchplain;
 
37
                StringReplace(query, "&amp;", "&");
 
38
                SearchTimer s;
 
39
                s.SetId(0);
 
40
                s.SetSearch(query);
 
41
                s.SetSearchMode(0);
 
42
                s.SetUseTitle(true);            
 
43
                s.SetUseSubtitle(false);
 
44
                s.SetUseDescription(false);             
 
45
                results.GetByQuery(s.ToText());
 
46
        }
 
47
</%cpp>
 
48
<& pageelems.doc_type &>
 
49
<html>
 
50
        <head>
 
51
                <title>VDR-Live - <$ pageTitle $></title>
 
52
                <link rel="stylesheet" type="text/css" href="/styles.css" />
 
53
                <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &>
 
54
                <& pageelems.ajax_js &>
 
55
        </head>
 
56
        <body onload="<& pageelems.infobox_start_update &>">
 
57
                <& pageelems.logo &>
 
58
                <& menu active=("searchepg") &>
 
59
                <div class="inhalt">
 
60
%           if (results.size() == 0) {
 
61
                <$ tr("No search results") $>
 
62
%           }
 
63
                        <table class="searchresults" cellspacing="0" callpadding="0">
 
64
<{
 
65
                                string current_day = "";
 
66
                                bool active_line = false;
 
67
                                EpgEvents epgEvents;
 
68
                                int evntNr = 0;
 
69
 
 
70
                                for (SearchResults::iterator result = results.begin(); result != results.end(); ++result) {
 
71
//                                      active_line = !active_line;
 
72
                                        string channelname = Channels.GetByChannelID(result->Channel())->Name();
 
73
                                        int channelnr = Channels.GetByChannelID(result->Channel())->Number();
 
74
                                        string start(result->StartTime() ? FormatDateTime(tr("%I:%M %p"), result->StartTime()) : "");
 
75
                                        string end(result->StopTime() ? FormatDateTime(tr("%I:%M %p"), result->StopTime()) : "");
 
76
                                        string day(result->StartTime() ? FormatDateTime(tr("%A, %b %d %Y"), result->StartTime()) : "");
 
77
                                        tEventID event = result->EventId();
 
78
                                        tChannelID channel_id(result->Channel());
 
79
                                        string description = result->Description();
 
80
 
 
81
                                        
 
82
                                        string evntId("eventId_");
 
83
                                        evntId += lexical_cast<std::string, int>(++evntNr);
 
84
                                        EpgEventPtr epgEvent(new EpgEvent(evntId, channelname, result->Title(), result->ShortText(), description, result->StartTime(), result->StopTime()));
 
85
                                        epgEvents.push_back(epgEvent);
 
86
                                        bool truncated = false;
 
87
 
 
88
                                        if (current_day != day) {
 
89
                                                if (current_day != "") {
 
90
}>
 
91
                                                <tr>
 
92
                                                        <td colspan="5" style="border-top: 1px solid black; border-bottom: none; background-image: none">&nbsp;</td></tr>
 
93
                                                </tr>
 
94
<{
 
95
                                                }
 
96
}>
 
97
                                                <tr>
 
98
                                                        <td class="day" colspan="5"><div class="boxheader"><div><div><$ day $></div></div></div></td>
 
99
                                                </tr>
 
100
%                                       current_day = day;
 
101
%                                       }
 
102
                    <tr class="<? active_line ? "active" ?>">
 
103
                                                <td style="border-left: 1px solid black"><& pageelems.event_timer channelid=(channel_id) eventid=(event)&></td>
 
104
                                                <td><a href="schedule.html?channel=<$ channelnr $>"><$ channelname $></a></td>
 
105
                                                <td><$ start $> - <$ end $></td>
 
106
 
 
107
                                                <td>
 
108
                                                        <div class="more"<& tooltip.hint text=(StringEscapeAndBreak(StringWordTruncate(description, 300, truncated)) + string("<br />") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><strong><$ result->Title() $></strong></div><$ result->ShortText() $><br />
 
109
                                                </td>
 
110
                                                
 
111
                                                <td style="border-right: 1px solid black">&nbsp;</td>
 
112
                                        </tr>
 
113
%                               }
 
114
%                               if (results.size() > 0) {
 
115
                                                <tr>
 
116
                                                        <td colspan="5" style="border-top: 1px solid black; background: none; border-bottom: none">&nbsp;</td>
 
117
                                                </tr>
 
118
%                               }
 
119
                        </table>
 
120
                </div>
 
121
                <div class="epg_data" style="display: none;">
 
122
<{
 
123
                // create hidden div for the tooltip hints.
 
124
                for (vector<EpgEventPtr>::iterator i = epgEvents.begin(); i != epgEvents.end(); ++i) {
 
125
                        EpgEventPtr epg = *i;
 
126
}>
 
127
                        <& pageelems.epg_tt_box boxId=(epg->Id()) caption=(epg->Caption()) time=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) short_descr=(epg->ShortDescr()) long_descr=(epg->LongDescr()) elapsed=(epg->Elapsed()) &>
 
128
<{
 
129
                }
 
130
}>
 
131
                </div>
 
132
        </body>
 
133
</html>
 
134
 
 
135
<%include>page_exit.eh</%include>
 
136
 
 
137