projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
be1b969
)
Use the tabbed dialog API from tabs.c for
author
Art Cancro
<ajc@citadel.org>
Sat, 19 May 2007 20:03:34 +0000
(20:03 +0000)
committer
Art Cancro
<ajc@citadel.org>
Sat, 19 May 2007 20:03:34 +0000
(20:03 +0000)
the address book
webcit/messages.c
patch
|
blob
|
history
webcit/tabs.c
patch
|
blob
|
history
diff --git
a/webcit/messages.c
b/webcit/messages.c
index 9b60f23bc35ed7971e883984d0d231b6c9c6ad72..52a1824ea89e4c06da81307fc8b191e29e2fdb39 100644
(file)
--- a/
webcit/messages.c
+++ b/
webcit/messages.c
@@
-1819,11
+1819,13
@@
void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
int bg = 0;
static int NAMESPERPAGE = 60;
int num_pages = 0;
int bg = 0;
static int NAMESPERPAGE = 60;
int num_pages = 0;
- int page = 0;
int tabfirst = 0;
int tabfirst = 0;
- char tabfirst_label[
SIZ
];
+ char tabfirst_label[
64
];
int tablast = 0;
int tablast = 0;
- char tablast_label[SIZ];
+ char tablast_label[64];
+ char this_tablabel[64];
+ int page = 0;
+ char **tablabels;
if (num_ab == 0) {
wprintf("<br /><br /><br /><div align=\"center\"><i>");
if (num_ab == 0) {
wprintf("<br /><br /><br /><div align=\"center\"><i>");
@@
-1836,66
+1838,70
@@
void do_addrbook_view(struct addrbookent *addrbook, int num_ab) {
qsort(addrbook, num_ab, sizeof(struct addrbookent), abcmp);
}
qsort(addrbook, num_ab, sizeof(struct addrbookent), abcmp);
}
- num_pages =
num_ab / NAMESPERPAGE
;
+ num_pages =
(num_ab / NAMESPERPAGE) + 1
;
- page = atoi(bstr("page"));
+ tablabels = malloc(num_pages * sizeof (char *));
+ if (tablabels == NULL) {
+ wprintf("<br /><br /><br /><div align=\"center\"><i>");
+ wprintf(_("An internal error has occurred."));
+ wprintf("</i></div>\n");
+ return;
+ }
- wprintf("Page: ");
- for (i=0; i<=num_pages; ++i) {
- if (i != page) {
- wprintf("<a href=\"readfwd?page=%d\">", i);
- }
- else {
- wprintf("<B>");
- }
+ for (i=0; i<num_pages; ++i) {
tabfirst = i * NAMESPERPAGE;
tablast = tabfirst + NAMESPERPAGE - 1;
if (tablast > (num_ab - 1)) tablast = (num_ab - 1);
nametab(tabfirst_label, addrbook[tabfirst].ab_name);
nametab(tablast_label, addrbook[tablast].ab_name);
tabfirst = i * NAMESPERPAGE;
tablast = tabfirst + NAMESPERPAGE - 1;
if (tablast > (num_ab - 1)) tablast = (num_ab - 1);
nametab(tabfirst_label, addrbook[tabfirst].ab_name);
nametab(tablast_label, addrbook[tablast].ab_name);
- wprintf("[%s - %s]",
- tabfirst_label, tablast_label
- );
- if (i != page) {
- wprintf("</A>\n");
- }
- else {
- wprintf("</B>\n");
- }
+ sprintf(this_tablabel, "%s - %s", tabfirst_label, tablast_label);
+ tablabels[i] = strdup(this_tablabel);
}
}
- wprintf("<br />\n");
- wprintf("<table border=0 cellspacing=0 "
- "cellpadding=3 width=100%%>\n"
- );
+ tabbed_dialog(num_pages, tablabels);
+ page = (-1);
for (i=0; i<num_ab; ++i) {
for (i=0; i<num_ab; ++i) {
- if ((i / NAMESPERPAGE) == page) {
+ if ((i / NAMESPERPAGE) != page) { /* New tab */
+ page = (i / NAMESPERPAGE);
+ if (page > 0) {
+ wprintf("</tr></table>\n");
+ end_tab(page-1, num_pages);
+ }
+ begin_tab(page, num_pages);
+ wprintf("<table border=0 cellspacing=0 cellpadding=3 width=100%%>\n");
+ displayed = 0;
+ }
- if ((displayed % 4) == 0) {
- if (displayed > 0) {
- wprintf("</tr>\n");
- }
- bg = 1 - bg;
- wprintf("<tr bgcolor=\"#%s\">",
- (bg ? "DDDDDD" : "FFFFFF")
- );
+ if ((displayed % 4) == 0) {
+ if (displayed > 0) {
+ wprintf("</tr>\n");
}
}
-
- wprintf("<td>");
-
- wprintf("<a href=\"readfwd?startmsg=%ld&is_singlecard=1",
- addrbook[i].ab_msgnum);
- wprintf("?maxmsgs=1?summary=0?alpha=%s\">", bstr("alpha"));
- vcard_n_prettyize(addrbook[i].ab_name);
- escputs(addrbook[i].ab_name);
- wprintf("</a></td>\n");
- ++displayed;
+ bg = 1 - bg;
+ wprintf("<tr bgcolor=\"#%s\">",
+ (bg ? "DDDDDD" : "FFFFFF")
+ );
}
}
+
+ wprintf("<td>");
+
+ wprintf("<a href=\"readfwd?startmsg=%ld&is_singlecard=1",
+ addrbook[i].ab_msgnum);
+ wprintf("?maxmsgs=1?summary=0?alpha=%s\">", bstr("alpha"));
+ vcard_n_prettyize(addrbook[i].ab_name);
+ escputs(addrbook[i].ab_name);
+ wprintf("</a></td>\n");
+ ++displayed;
}
wprintf("</tr></table>\n");
}
wprintf("</tr></table>\n");
+ end_tab((num_pages-1), num_pages);
+
+ for (i=0; i<num_pages; ++i) {
+ free(tablabels[i]);
+ }
+ free(tablabels);
}
}
diff --git
a/webcit/tabs.c
b/webcit/tabs.c
index f0c72b06911e5a77305f7538187b3f79507d6599..72fc34073c9ab6a584078f1bfd1c62d2bdf4e99f 100644
(file)
--- a/
webcit/tabs.c
+++ b/
webcit/tabs.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id
:
$
+ * $Id$
*/
/**
* \defgroup TabUtils Utility functions for creating tabbed dialogs
*/
/**
* \defgroup TabUtils Utility functions for creating tabbed dialogs
@@
-61,6
+61,7
@@
void tabbed_dialog(int num_tabs, char *tabnames[]) {
* \param num_tabs total number oftabs to be printed
*/
void begin_tab(int tabnum, int num_tabs) {
* \param num_tabs total number oftabs to be printed
*/
void begin_tab(int tabnum, int num_tabs) {
+ wprintf("<!-- begin tab %d of %d -->\n", tabnum, num_tabs);
wprintf("<div id=\"tabdiv%d\" style=\"display:%s\">",
tabnum,
( (tabnum == 0) ? "block" : "none" )
wprintf("<div id=\"tabdiv%d\" style=\"display:%s\">",
tabnum,
( (tabnum == 0) ? "block" : "none" )
@@
-70,7
+71,7
@@
void begin_tab(int tabnum, int num_tabs) {
/**
* \brief print the tab-footer
* \param tabnum number of the tab to print
/**
* \brief print the tab-footer
* \param tabnum number of the tab to print
- * \param num_tabs total number oftabs to be printed
+ * \param num_tabs total number of
tabs to be printed
*/
void end_tab(int tabnum, int num_tabs) {
wprintf("</div>\n");
*/
void end_tab(int tabnum, int num_tabs) {
wprintf("</div>\n");
@@
-82,7
+83,6
@@
void end_tab(int tabnum, int num_tabs) {
" Nifty(\"table#TheTabs td\", \"small transparent top\");"
"</script>"
);
" Nifty(\"table#TheTabs td\", \"small transparent top\");"
"</script>"
);
- //" Nifty(\"td#tabtd1\", \"small transparent top\");"
}
}
}
}