The record command now has activeclients (as in show), nextrecid
(if such record exist), prevrecid (if such record exist). This allows
navigation on single records and check for whether the system is idle
(activeclients == 0). Bug #3012.
struct http_response *rs = c->response;
struct http_request *rq = c->request;
struct http_session *s = locate_session(rq, rs);
struct http_response *rs = c->response;
struct http_request *rq = c->request;
struct http_session *s = locate_session(rq, rs);
- struct record_cluster *rec;
+ struct record_cluster *rec, *prev_r, *next_r;
struct record *r;
struct conf_service *service = global_parameters.server->service;
const char *idstr = http_argbyname(rq, "id");
struct record *r;
struct conf_service *service = global_parameters.server->service;
const char *idstr = http_argbyname(rq, "id");
return;
}
wrbuf_rewind(c->wrbuf);
return;
}
wrbuf_rewind(c->wrbuf);
- if (!(rec = show_single(s->psession, idstr)))
+ if (!(rec = show_single(s->psession, idstr, &prev_r, &next_r)))
{
if (session_set_watch(s->psession, SESSION_WATCH_RECORD,
cmd_record_ready, c, c) != 0)
{
if (session_set_watch(s->psession, SESSION_WATCH_RECORD,
cmd_record_ready, c, c) != 0)
wrbuf_puts(c->wrbuf, "<recid>");
wrbuf_xmlputs(c->wrbuf, rec->recid);
wrbuf_puts(c->wrbuf, "</recid>\n");
wrbuf_puts(c->wrbuf, "<recid>");
wrbuf_xmlputs(c->wrbuf, rec->recid);
wrbuf_puts(c->wrbuf, "</recid>\n");
+ if (prev_r)
+ {
+ wrbuf_puts(c->wrbuf, "<prevrecid>");
+ wrbuf_xmlputs(c->wrbuf, prev_r->recid);
+ wrbuf_puts(c->wrbuf, "</prevrecid>\n");
+ }
+ if (next_r)
+ {
+ wrbuf_puts(c->wrbuf, "<nextrecid>");
+ wrbuf_xmlputs(c->wrbuf, next_r->recid);
+ wrbuf_puts(c->wrbuf, "</nextrecid>\n");
+ }
+ wrbuf_printf(c->wrbuf, "<activeclients>%d</activeclients>\n",
+ session_active_clients(s->psession));
write_metadata(c->wrbuf, service, rec->metadata, 1);
for (r = rec->records; r; r = r->next)
write_subrecord(r, c->wrbuf, service, 1);
write_metadata(c->wrbuf, service, rec->metadata, 1);
for (r = rec->records; r; r = r->next)
write_subrecord(r, c->wrbuf, service, 1);
-struct record_cluster *show_single(struct session *s, const char *id)
+struct record_cluster *show_single(struct session *s, const char *id,
+ struct record_cluster **prev_r,
+ struct record_cluster **next_r)
{
struct record_cluster *r;
reclist_rewind(s->reclist);
{
struct record_cluster *r;
reclist_rewind(s->reclist);
+ *prev_r = 0;
+ *next_r = 0;
while ((r = reclist_read_record(s->reclist)))
while ((r = reclist_read_record(s->reclist)))
if (!strcmp(r->recid, id))
if (!strcmp(r->recid, id))
+ {
+ *next_r = reclist_read_record(s->reclist);
char *filter, const char **addinfo);
struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
int *num, int *total, int *sumhits, NMEM nmem_show);
char *filter, const char **addinfo);
struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
int *num, int *total, int *sumhits, NMEM nmem_show);
-struct record_cluster *show_single(struct session *s, const char *id);
+struct record_cluster *show_single(struct session *s, const char *id,
+ struct record_cluster **prev_r,
+ struct record_cluster **next_r);
struct termlist_score **termlist(struct session *s, const char *name, int *num);
int session_set_watch(struct session *s, int what, session_watchfun fun, void *data, struct http_channel *c);
int session_active_clients(struct session *s);
struct termlist_score **termlist(struct session *s, const char *name, int *num);
int session_set_watch(struct session *s, int what, session_watchfun fun, void *data, struct http_channel *c);
int session_active_clients(struct session *s);
<record>
<recid>title how to program a computer author jack collins medium book</recid>
<record>
<recid>title how to program a computer author jack collins medium book</recid>
+<nextrecid>title computer processing of dynamic images from an anger scintillation camera author medium book</nextrecid>
+<activeclients>0</activeclients>
<md-title>How to program a computer</md-title>
<md-author>Jack Collins</md-author>
<md-title>How to program a computer</md-title>
<md-author>Jack Collins</md-author>
<record>
<recid>title how to program a computer author jack collins medium book</recid>
<record>
<recid>title how to program a computer author jack collins medium book</recid>
+<nextrecid>title the use of passwords for controlled access to computer resources author wood helen m medium book</nextrecid>
+<activeclients>0</activeclients>
<md-title>How to program a computer</md-title>
<md-author>Jack Collins</md-author>
<md-title>How to program a computer</md-title>
<md-author>Jack Collins</md-author>