/* $Id: map.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */ /* * client-side image maps */ #include "fm.h" #ifdef MENU_MAP char * follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int y) { MapList *ml; char *name; TextListItem *t, *s; int i, n, selected = -1; char **label; name = tag_get_value(arg, "link"); if (name == NULL) return NULL; for (ml = buf->maplist; ml != NULL; ml = ml->next) { if (!Strcmp_charp(ml->name, name)) break; } if (ml == NULL) return NULL; for (n = 0, t = ml->urls->first; t != NULL; n++, t = t->next); if (n == 0) return NULL; label = New_N(char *, n + 1); for (i = 0, t = ml->urls->first, s = ml->alts->first; t != NULL; i++, t = t->next, s = s->next) label[i] = *s->ptr ? s->ptr : t->ptr; label[n] = NULL; optionMenu(x, y, label, &selected, 0, NULL); if (selected >= 0) { for (i = 0, t = ml->urls->first; t != NULL; i++, t = t->next) if (i == selected) return t->ptr; } return NULL; } #else char *map1 = "
Title | "); Strcat_charp(tmp, html_quote(buf->buffername)); Strcat_charp(tmp, " |
Current URL | "); Strcat_charp(tmp, html_quote(parsedURL2Str(&buf->currentURL)->ptr)); Strcat_charp(tmp, " |
Document Type | "); if (buf->real_type) Strcat_charp(tmp, buf->real_type); else Strcat_charp(tmp, "unknown"); Strcat_charp(tmp, " |
Last Modified | "); Strcat_charp(tmp, html_quote(last_modified(buf))); #ifdef JP_CHARSET Strcat_charp(tmp, " |
Document Code | "); Strcat_charp(tmp, code_to_str(buf->document_code)); #endif /* JP_CHARSET */ Strcat_charp(tmp, " |
Number of line | "); all = buf->allLine; if (all == 0 && buf->lastLine) all = buf->lastLine->linenumber; Strcat(tmp, Sprintf("%d", all)); Strcat_charp(tmp, " |
Transferred byte | "); Strcat(tmp, Sprintf("%d", buf->trbyte)); a = retrieveCurrentAnchor(buf); if (a != NULL) { parseURL2(a->url, &pu, baseURL(buf)); s = parsedURL2Str(&pu); Strcat_charp(tmp, " |
URL of current anchor | "); Strcat_charp(tmp, html_quote(s->ptr)); } a = retrieveCurrentImg(buf); if (a != NULL) { parseURL2(a->url, &pu, baseURL(buf)); s = parsedURL2Str(&pu); Strcat_charp(tmp, " |
URL of current image | "); Strcat_charp(tmp, "ptr)); Strcat_charp(tmp, "\">"); Strcat_charp(tmp, html_quote(s->ptr)); Strcat_charp(tmp, ""); } a = retrieveCurrentForm(buf); if (a != NULL) { s = Strnew_charp(form2str((FormItemList *) a->url)); Strcat_charp(tmp, " |
Method/type of current form | "); Strcat_charp(tmp, html_quote(s->ptr)); } Strcat_charp(tmp, " |
"); append_frame_info(buf, tmp, f_set, 0); Strcat_charp(tmp, ""); } #ifdef USE_SSL if (buf->ssl_certificate == NULL) goto end; Strcat_charp(tmp, "
\n"); Strcat_charp(tmp, buf->ssl_certificate); Strcat_charp(tmp, "\n"); #endif end: Strcat_charp(tmp, ""); return loadHTMLString(tmp); }