RE: [greenstone-devel] moving home icon

From Emanuel Dejanu / Simple Words
DateWed, 12 May 2004 11:48:16 +0300
Subject RE: [greenstone-devel] moving home icon
In-Reply-To (40A168F2-1040600-cs-waikato-ac-nz)
Hi Linda,

Here is the code changes that we made so we can add more buttons to the
navigation bar.

macros: document.dm

package document

_staticclassifierswidth_ {_widthstaticclass_}
# number of static classifiers or number of buttons
_nostaticclassifiers_ {1}
# static classifiers buttons
# to define more buttons _imageBtn1__imagespacer__imageBtn2_ ....
_staticclassifiers_ {_imageTopic_}

And _widthstaticclass_ is defined in each interface language
with all buttons width.

In this example we add a topic button.

Modified functions is in the attached file (src/recpt/documentaction.cpp).

You can also change after which button search button appears with macro

_searchbtnafter_ {CL1}

In this example search button will appear after CL1 button.


Best regards,

Emanuel Dejanu
Human Info/Simple Words

-----Original Message-----
From: greenstone-devel-bounces@list.scms.waikato.ac.nz
[mailto:greenstone-devel-bounces@list.scms.waikato.ac.nz] On Behalf Of
Katherine Don
Sent: Wednesday, May 12, 2004 3:00 AM
To: cantara@case.edu
Cc: Greenstone Developers
Subject: Re: [greenstone-devel] moving home icon

Hi Linda

There are several ways to accomplish this.

1. The navigation bar macro is defined by the runtime library - you can
modify the C++ code to add the home button in to the navigationbar macro.
Look at setnavbarmacros() in src/recpt/documentaction.cpp.

2. If you always have the same navigation bar i.e. the browse options are
fixed, you can define eg _mynavigationbar_ macro in base.dm, and replace all
references to SearchSubjectsFromDates in the other macro files with
_mynavigationbar_ . Use _icontabsearchgreen_ and _imagesearch_ macros for
the search button (clickable button and non-clickable image, respectively),
and _icontabTitlegreen_ and _imageTitle_ for the Title button (and similarly
for other metadata).

3. If the browse options differ for each collection, you can use the
predefined SearchSubjectsFromDates macro inside something else and add the home
button on the end.

eg, try something like this:
inside the

macro in style.dm add the following as the last row
in the table
<tr>
<td colspan=2>
<table border="0" cellspacing = "0" cellpadding="0" width="100%>
<tr nowrap="nowrap">
<td nowrap="nowrap" > SearchSubjectsFromDates </td>
<td nowrap="nowrap" >_imagehome_</td>
</tr>
</table>
</td>
</tr>

You will need to remove the SearchSubjectsFromDates macro from the content of each
page (alternatively put the above in each content macro) You will probably
need to play with the images for the buttons and the spacers so that the bar
looks nice.
And play with the macro a bit so that this doesn't get used if you are on
the home page.

Well, I hope this gives you something to start from :-)

Regards,
Katherine Don

Linda Cantara wrote:
> I have removed the 'help' and 'preferences' buttons from the top right
> of all pages, and would also like to remove the 'home' button from the
> homepage AND on the other pages,
> integrate 'home' into the navigation bar
(search|browse1|browse2|browse3|home).

> Are these two things possible and if so, how do I accomplish this?
>
> Thank you,
>
> Linda
>
> **********************************************
> Linda Cantara, Metadata Librarian
> 201G Kelvin Smith Library
> 11055 Euclid Avenue
> Case Western Reserve University
> Cleveland, Ohio 44106
> phone: 216-368-6504
> fax: 216-368-3669
> email: linda.cantara@case.edu
> http://www.case.edu/UL/CatDat/cantara/lmc.html
>
>
> _______________________________________________
> greenstone-devel mailing list
> greenstone-devel@list.scms.waikato.ac.nz
> https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-devel
>

_______________________________________________
greenstone-devel mailing list
greenstone-devel@list.scms.waikato.ac.nz
https://list.scms.waikato.ac.nz/mailman/listinfo/greenstone-devel


<<attachment>>
Type: text/plain
Filename: documentaction.txt

void documentaction::set_spacemacro (displayclass &disp, FilterResponse_t &response,
bool has_search_button)
{

text_t width;
int twidth, swidth, iwidth = 0;

int numc = response.docInfo.size();
ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
ResultDocInfo_tarray::iterator docend = response.docInfo.end();

disp.expandstring (displayclass::defaultpackage, "537", width);
twidth = width.getint();

if (has_search_button) {
disp.expandstring (displayclass::defaultpackage, "_widthtsrchx_", width);
iwidth += width.getint();
} else {
numc -= 1;
}

while (dochere != docend) {
const text_t &title = (*dochere).metadata["Title"].values[0];

disp.expandstring ("document", "_" + title + "width_", width);
if (width == ("_" + title + "width_"))
disp.expandstring ("document", "87", width);
iwidth += width.getint();
++dochere;
}

disp.expandstring ("document", "_staticclassifierswidth_", width);
twidth -= width.getint();
disp.expandstring ("document", "_nostaticclassifiers_", width);
numc += width.getint();

if ((twidth - iwidth) < numc) swidth = 2;
else {
swidth = twidth - iwidth;
if (numc > 0) swidth = swidth / numc;
}
disp.setmacro ("widthtspace", displayclass::defaultpackage, swidth);
}

void documentaction::set_navbarmacros (displayclass &disp, FilterResponse_t &response,
bool has_search_button, cgiargsclass &args,
ColInfoResponse_t &cinfo)
{


bool use_pulldown = false;
text_tmap::iterator it = cinfo.format.find("NavigationBar");
if (it != cinfo.format.end()) {
if (it->second == "pulldown") {
use_pulldown = true;
}
}

text_t strSearchAfter;

disp.expandstring("document", "_searchbtnafter_", strSearchAfter);

if (strSearchAfter == "_searchbtnafter_") strSearchAfter.clear();

text_t topparent;
text_t &arg_d = args["d"];
text_t navigationbar = "<!-- Navigation Bar --> ";

text_t date_extra = "";

if (arg_d.empty()) {
disp.setmacro("IsEmptyArgD", displayclass::defaultpackage, "1");
} else {
disp.setmacro("IsEmptyArgD", displayclass::defaultpackage, "0");
}
get_top (args["cl"], topparent);
int numc = response.docInfo.size();
ResultDocInfo_tarray::iterator dochere = response.docInfo.begin();
ResultDocInfo_tarray::iterator docend = response.docInfo.end();

if (!use_pulldown) {
navigationbar += "<nobr> ";
text_t static_cl;
bool first = true;
disp.expandstring ("document", "_staticclassifiers_", static_cl);
if (has_search_button) {
if (strSearchAfter.empty()) {
set_search_macros(args["a"], navigationbar, disp);
first = false;
}
} else {
disp.setmacro("IsSearchPage", displayclass::defaultpackage, g_EmptyText);
}

while (dochere != docend) {
date_extra.clear();

if (!first) navigationbar += "_imagespacer_";

text_t title = dochere->metadata["Title"].values[0];
if (title == "Date") { // a date list
text_t date_meta = (*dochere).metadata["mdtype"].values[0];
if (date_meta.empty()) {
date_meta = "Date";
}
date_extra = "&amp;dm="+date_meta;
}
bool unknown = false;

// test the _XXXwidth_ macro to see if image macros are
// defined for this type of classification - if not we'll
// just display the text
text_t tmpwidth;
disp.expandstring ("document", "_" + title + "width_", tmpwidth);
if (tmpwidth == ("_" + title + "width_")) unknown = true;

if (arg_d.empty() && dochere->OID == topparent) {
disp.setmacro("cl" + dochere->OID + "Btn", displayclass::defaultpackage, "_cl" + dochere->OID + "BtnActive_");
disp.setmacro("Is" + dochere->OID + "Page", displayclass::defaultpackage, "1");
} else {
disp.setmacro("cl" + dochere->OID + "Btn", displayclass::defaultpackage, "_cl" + dochere->OID + "BtnNormal_");
disp.setmacro("Is" + dochere->OID + "Page", displayclass::defaultpackage, g_EmptyText);
}

// if we're inside a document all the classification buttons should be enabled
if (arg_d.empty() && (dochere->OID == topparent)) {
if (unknown) navigationbar += "&nbsp;" + title + "&nbsp;";
else navigationbar += "_icontab" + title + "green_";
} else {

// set the _httpbrowseXXX_ macro for this classification
if (unknown) navigationbar += "&nbsp;<a href="/gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Saidis+Kostas--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=d&amp;cl=" +
dochere->OID + date_extra + "">" + title + "</a>&nbsp;";
else {
navigationbar += "_image" + title + "_";
disp.setmacro ("httpbrowse" + title, displayclass::defaultpackage, "/gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Saidis+Kostas--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=d&amp;cl=" + (*dochere).OID + date_extra);
}
}
if (has_search_button && strSearchAfter == dochere->OID) {
navigationbar += "_imagespacer_";
set_search_macros(args["a"], navigationbar, disp);
}

++dochere;
first = false;
}

if (static_cl != "_staticclassifiers_") {
if (!first) navigationbar += "_imagespacer_";
navigationbar += "_document:staticclassifiers_";
}
//if (!has_search_button && numc == 1) navigationbar += "_imagespacer_";

navigationbar += " </nobr> ";
navigationbar += "<!-- End of Navigation Bar --> ";

} else {

navigationbar = "<form method="get" name="navform"> ";
navigationbar += "<select name="navbar" onChange="location.href=";
navigationbar += "document.navform.navbar.options[document.navform.navbar.selectedIndex].value"> ";

if (args["a"] != "q" && args["cl"].empty()) {
navigationbar += "<option value="" selected>-- Select Page --</option> ";
}

if (has_search_button) {
navigationbar += "<option value="/gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Saidis+Kostas--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=q"";
if (args["a"] == "q") {
navigationbar += " selected";
}
navigationbar += ">_texticontabsearchgreen_</option> ";
}

while (dochere != docend) {
text_t title = dochere->metadata["Title"].values[0];
if (title == "Date") { // a date list
text_t date_meta = (*dochere).metadata["mdtype"].values[0];
if (date_meta.empty()) {
date_meta = "Date";
}
date_extra = "&amp;dm="+date_meta;
}
navigationbar += "<option value="/gsdlmod?e=d-00000-00---off-0gsarch--00-0----0-10-0---0---0direct-10---4-----dfr--0-1l--11-en-50---20-about-Saidis+Kostas--00-0-1-00-0--4----0-0-11-10-0utfZz-8-00&a=d&amp;cl=" + dochere->OID + date_extra + """;
if (topparent == dochere->OID) {
navigationbar += " selected";
}
navigationbar += ">" + title + "</option> ";
++dochere;
}

navigationbar += "</select> ";
navigationbar += "</form> ";
}
text_t currentCLDescription = g_EmptyText;
if (!args["cl"].empty() && args["d"].empty()) {
text_t::iterator pointPos = findchar(args["cl"].begin(), args["cl"].end(), '.');
if (pointPos == args["cl"].end()) {
currentCLDescription = "_" + args["cl"] + "description_";
} else {
currentCLDescription.append("_");
currentCLDescription.appendrange(args["cl"].begin(), pointPos);
currentCLDescription.append("description_");
}
text_t expandCCLDesc;
disp.expandstring ("document", currentCLDescription, expandCCLDesc);
if (expandCCLDesc != currentCLDescription) {
navigationbar += currentCLDescription + " ";
} else {
currentCLDescription.clear();
}
}

disp.setmacro ("currentCLDescription", "document", currentCLDescription);
disp.setmacro ("navigationbar", displayclass::defaultpackage, navigationbar);
}