[Refdb-cvs] CVS: refdb/src backendn-html.c,1.6.2.3,1.6.2.4 backendn-notex.c,1.8.2.3,1.8.2.4 backendn
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-09-19 20:10:38
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10471 Modified Files: Tag: Release_0_9_5_stable backendn-html.c backendn-notex.c backendn-scrn.c noteshandler.c Log Message: more ulink fixes Index: backendn-html.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backendn-html.c,v retrieving revision 1.6.2.3 retrieving revision 1.6.2.4 diff -u -U2 -r1.6.2.3 -r1.6.2.4 --- backendn-html.c 28 May 2005 20:11:33 -0000 1.6.2.3 +++ backendn-html.c 19 Sep 2005 20:10:29 -0000 1.6.2.4 @@ -408,4 +408,89 @@ } + /*----------------------------------------------------------------*/ + /* ulink */ + if (strstr((ptr_rendinfo->ptr_biblio_info)->format_string, "UR") != NULL + || strstr((ptr_rendinfo->ptr_biblio_info)->format_string, "ALL") != NULL) { + int i; + char *entitize_string; + char keytype[5][10] = {"URL", "PDF", "FULLTEXT", "RELATED", "IMAGE"}; + char buffer[64]; + dbi_result dbires; + + /* loop over all link types */ + for (i=0; i<5;i++) { + dbires = request_ulinks(conn, my_dbi_result_get_idval(ptr_rendinfo->dbires, "note_id"), 1 /* notes entry */, i /* link type */); + if (dbires == NULL) { + return 234; + } + + while ((citem = get_ulink(dbires)) != NULL) { + sprintf(buffer, "<p class='ur'>%s: <a href=\"", keytype[i]); + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), buffer, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + if ((entitize_string = strdup(citem)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + return 801; + } + + if (sgml_entitize(&entitize_string, NULL) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + free(entitize_string); + return 801; + } + + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), entitize_string, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + free(entitize_string); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "\">", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + free(entitize_string); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), entitize_string, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + free(entitize_string); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + free(entitize_string); + + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "</a></p>\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + } /* end while */ + clean_request(dbires); + } /* end for */ + } + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "</div>\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { LOG_PRINT(LOG_CRIT, get_status_msg(801)); Index: backendn-notex.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backendn-notex.c,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -u -U2 -r1.8.2.3 -r1.8.2.4 --- backendn-notex.c 20 May 2005 23:17:56 -0000 1.8.2.3 +++ backendn-notex.c 19 Sep 2005 20:10:29 -0000 1.8.2.4 @@ -279,4 +279,42 @@ + /*----------------------------------------------------------------*/ + /* ulink */ + + /* loop over all link types */ + for (i=0; i<5;i++) { + char ulink_type[10]; + dbi_result dbires; + + dbires = request_ulinks(conn, my_dbi_result_get_idval(ptr_rendinfo->dbires, "note_id"), 1 /* notes entry */, i /* link type */); + if (dbires == NULL) { + return 234; + } + + while ((citem = get_ulink(dbires)) != NULL) { + if (i == 0) { + strcpy(ulink_type, "url"); + } + else if (i == 1) { + strcpy(ulink_type, "pdf"); + } + else if (i == 2) { + strcpy(ulink_type, "fulltext"); + } + else if (i == 3) { + strcpy(ulink_type, "related"); + } + else if (i == 4) { + strcpy(ulink_type, "image"); + } + if (print_element_x(citem, ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "ulink", "type", ulink_type, &xindent) == NULL) { + clean_request(dbires); + return 801; + } + } + + clean_request(dbires); + } /* end for */ + if (print_elend_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "xnote", &xindent) == NULL) { return 801; Index: backendn-scrn.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backendn-scrn.c,v retrieving revision 1.3.2.2 retrieving revision 1.3.2.3 diff -u -U2 -r1.3.2.2 -r1.3.2.3 --- backendn-scrn.c 17 Apr 2005 00:09:09 -0000 1.3.2.2 +++ backendn-scrn.c 19 Sep 2005 20:10:29 -0000 1.3.2.3 @@ -351,4 +351,58 @@ } + /*----------------------------------------------------------------*/ + /* ulink */ + if (strstr((ptr_rendinfo->ptr_biblio_info)->format_string, "UR") != NULL + || strstr((ptr_rendinfo->ptr_biblio_info)->format_string, "ALL") != NULL) { + int i; + char link_tag[12]; + + /* loop over all link types */ + for (i=0; i<5;i++) { + if (!i) { + strcpy(link_tag, "\nURL: "); + } + else if (i == 1) { + strcpy(link_tag, "\nPDF: "); + } + else if (i == 2) { + strcpy(link_tag, "\nFULLTEXT: "); + } + else if (i == 3) { + strcpy(link_tag, "\nRELATED: "); + } + else if (i == 4) { + strcpy(link_tag, "\nIMAGE: "); + } + + dbires = request_ulinks(conn, my_dbi_result_get_idval(ptr_rendinfo->dbires, "note_id"), 1 /* note entry */, i /* link type */); + if (dbires == NULL) { + return 234; + } + + while ((citem = get_ulink(dbires)) != NULL) { + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), link_tag, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), (char*)citem, ptr_rendinfo->ptr_ref_len, 0)) == NULL) { + LOG_PRINT(LOG_CRIT, get_status_msg(801)); + clean_request(dbires); + return 801; + } + else { + *(ptr_rendinfo->ptr_ref) = new_ref; + } + + } /* end while */ + clean_request(dbires); + } /* end for */ + } + /* finish with an empty line */ if ((new_ref = mstrcat(*(ptr_rendinfo->ptr_ref), "\n\n", ptr_rendinfo->ptr_ref_len, 0)) == NULL) { Index: noteshandler.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/noteshandler.c,v retrieving revision 1.18.2.8 retrieving revision 1.18.2.9 diff -u -U2 -r1.18.2.8 -r1.18.2.9 --- noteshandler.c 7 Sep 2005 23:45:02 -0000 1.18.2.8 +++ noteshandler.c 19 Sep 2005 20:10:29 -0000 1.18.2.9 @@ -372,4 +372,27 @@ + /* search orphans in t_xnote */ + result = remove_xnote_entries(ptr_andata->n_note_id, ptr_andata->conn, 4); + + if (result) { + if (result == 1) { + strcpy(sql_command, "select from t_xnote failed\n"); + } + else if (result == 3) { + strcpy(sql_command, "delete from t_xnote failed\n"); + } + + (ptr_andata->ndb_error)++; + + if ((new_msgpool = mstrcat(ptr_andata->msgpool, sql_command, &(ptr_andata->msgpool_len), 0)) == NULL) { + (ptr_andata->nmem_error)++; + return; + } + else { + ptr_andata->msgpool = new_msgpool; + } + return; + } + /* reset all values in t_note, keep key, use new type */ sprintf(sql_command, "UPDATE t_note SET note_title=NULL, note_content=NULL WHERE note_id="ULLSPEC, (unsigned long long)(ptr_andata->n_note_id)); |