1 | /**********************************************************************
|
---|
2 | *
|
---|
3 | * pagedbrowserclass.cpp --
|
---|
4 | * Copyright (C) 1999 The New Zealand Digital Library Project
|
---|
5 | *
|
---|
6 | * A component of the Greenstone digital library software
|
---|
7 | * from the New Zealand Digital Library Project at the
|
---|
8 | * University of Waikato, New Zealand.
|
---|
9 | *
|
---|
10 | * This program is free software; you can redistribute it and/or modify
|
---|
11 | * it under the terms of the GNU General Public License as published by
|
---|
12 | * the Free Software Foundation; either version 2 of the License, or
|
---|
13 | * (at your option) any later version.
|
---|
14 | *
|
---|
15 | * This program is distributed in the hope that it will be useful,
|
---|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | * GNU General Public License for more details.
|
---|
19 | *
|
---|
20 | * You should have received a copy of the GNU General Public License
|
---|
21 | * along with this program; if not, write to the Free Software
|
---|
22 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | *
|
---|
24 | *
|
---|
25 | *
|
---|
26 | *********************************************************************/
|
---|
27 |
|
---|
28 |
|
---|
29 | #include "cstrpagedbrowserclass.h"
|
---|
30 | #include <assert.h>
|
---|
31 | #include "OIDtools.h"
|
---|
32 |
|
---|
33 | cstrpagedbrowserclass::cstrpagedbrowserclass () {
|
---|
34 | }
|
---|
35 |
|
---|
36 | cstrpagedbrowserclass::~cstrpagedbrowserclass () {
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
40 | int cstrpagedbrowserclass::output_section_group (FilterResponse_t §ions, cgiargsclass &args,
|
---|
41 | const text_t &/*collection*/, int /*colnumber*/,
|
---|
42 | format_t * /*formatlistptr*/, bool /*use_table*/,
|
---|
43 | text_tset &/*metadata*/, bool &/*getParents*/,
|
---|
44 | recptproto * /*collectproto*/, displayclass &disp,
|
---|
45 | outconvertclass &outconvert, ostream &textout,
|
---|
46 | ostream &/*logout*/) {
|
---|
47 |
|
---|
48 | text_t &arg_d = args["d"];
|
---|
49 |
|
---|
50 | // this browser class only handles document levels
|
---|
51 | if (arg_d.empty()) return 0;
|
---|
52 |
|
---|
53 | // dont want page nums and arrows if text is expanded
|
---|
54 | if (!args.getintarg("gt")) {
|
---|
55 | text_t previousOID, previoustitle, nextOID, nexttitle;
|
---|
56 | text_t previousarrow, nextarrow;
|
---|
57 | bool found = false;
|
---|
58 |
|
---|
59 | text_t pagenum;
|
---|
60 | // this should be our list of pages
|
---|
61 |
|
---|
62 | ResultDocInfo_tarray::iterator thissection = sections.docInfo.begin();
|
---|
63 | ResultDocInfo_tarray::iterator endsection = sections.docInfo.end();
|
---|
64 |
|
---|
65 | while (thissection != endsection) {
|
---|
66 | if (arg_d == (*thissection).OID) {
|
---|
67 | found = true;
|
---|
68 | pagenum= "<td><center><b>_document:textpage_" +
|
---|
69 | (*thissection).metadata["Title"].values[0] + "\n";
|
---|
70 | if (thissection != sections.docInfo.begin()) {
|
---|
71 | previousOID = (*(thissection-1)).OID;
|
---|
72 | previoustitle = (*(thissection-1)).metadata["Title"].values[0];
|
---|
73 | } else
|
---|
74 | previousarrow = "_document:parentarrow_";
|
---|
75 |
|
---|
76 | if (thissection != sections.docInfo.end()) {
|
---|
77 | nextOID = (*(thissection+1)).OID;
|
---|
78 | nexttitle = (*(thissection+1)).metadata["Title"].values[0];
|
---|
79 | }
|
---|
80 | break;
|
---|
81 | }
|
---|
82 | thissection ++;
|
---|
83 | }
|
---|
84 |
|
---|
85 | int numpages = sections.docInfo.size();
|
---|
86 | //pagenum += "_document:textnumpages_(" + text_t(numpages) + ")</center></td>\n";
|
---|
87 | pagenum += "_document:of_" + text_t(numpages) + "</b></center></td>\n";
|
---|
88 | if (!found)
|
---|
89 | nextarrow = "<a href=\"_httpdocument_&cl=" + args["cl"] + "&d=" + sections.docInfo[0].OID +
|
---|
90 | "\">" + sections.docInfo[0].metadata["Title"].values[0] + "_iconnext_</a>\n";
|
---|
91 | else {
|
---|
92 | if (!previousOID.empty())
|
---|
93 | previousarrow = "<a href=\"_httpdocument_&cl=" + args["cl"] + "&d=" +
|
---|
94 | previousOID + "\">_iconprev_</a>\n";
|
---|
95 | if (!nextOID.empty())
|
---|
96 | nextarrow = "<a href=\"_httpdocument_&cl=" + args["cl"] + "&d=" +
|
---|
97 | nextOID + "\">_iconnext_</a>\n";
|
---|
98 | }
|
---|
99 |
|
---|
100 | textout << outconvert << disp << "<table><tr valign=top>"
|
---|
101 | << " <td align=right>" << previousarrow << "</td>\n"
|
---|
102 | << "<td align=center>" << pagenum << "</td>\n"
|
---|
103 | << "<td align=left>" << nextarrow << "</td></tr>\n"
|
---|
104 | << "<tr valign=middle>\n"
|
---|
105 | << "<td align=center valign=top colspan=3>_document:gotoform_</td>"
|
---|
106 | << "</tr></table>\n";
|
---|
107 | }
|
---|
108 | else { // just output goto form
|
---|
109 | textout << outconvert << disp << "<center>_document:gotoform_ </center>";
|
---|
110 | }
|
---|
111 | return 0;
|
---|
112 | }
|
---|
113 |
|
---|
114 |
|
---|
115 |
|
---|