[Refdb-cvs] CVS: refdb/src refdbdnote.c,1.25.2.10,1.25.2.11 backendn-notex.c,1.8.2.4,1.8.2.5
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-09-23 23:48:43
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29588 Modified Files: Tag: Release_0_9_5_stable refdbdnote.c backendn-notex.c Log Message: output xnote share attribute Index: refdbdnote.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbdnote.c,v retrieving revision 1.25.2.10 retrieving revision 1.25.2.11 diff -u -U2 -r1.25.2.10 -r1.25.2.11 --- refdbdnote.c 21 Sep 2005 23:38:35 -0000 1.25.2.10 +++ refdbdnote.c 23 Sep 2005 23:48:34 -0000 1.25.2.11 @@ -2087,5 +2087,5 @@ if (n_privatelist) { /* this list contains only the notes that belong to the user. We need not care about the share setting of the server or of extended notes */ - sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND ", ptr_clrequest->username); + sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_note.note_share, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND t_user.user_name=\'%s\' AND ", ptr_clrequest->username); } else { @@ -2094,10 +2094,10 @@ /* if the server shares by default, we need to make sure the notes of other users are not private */ - sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND (t_user.user_name=\'%s\' OR (t_user.user_name!=\'%s\' AND t_note.note_share!=0)) AND ", ptr_clrequest->username, ptr_clrequest->username); + sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_note.note_share, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND (t_user.user_name=\'%s\' OR (t_user.user_name!=\'%s\' AND t_note.note_share!=0)) AND ", ptr_clrequest->username, ptr_clrequest->username); } else { /* if the server is paranoid by default, we need to make sure the notes of other users are positively public */ - sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND (t_user.user_name=\'%s\' OR (t_user.user_name!=\'%s\' AND t_note.note_share=1)) AND ", ptr_clrequest->username, ptr_clrequest->username); + sprintf(sql_command, "SELECT DISTINCT t_note.note_id, t_note.note_key, t_note.note_title, t_note.note_user_id, t_note.note_date, t_note.note_content, t_note.note_content_type, t_note.note_content_xmllang, t_note.note_share, t_user.user_name FROM t_note,t_user WHERE t_note.note_user_id=t_user.user_id AND (t_user.user_name=\'%s\' OR (t_user.user_name!=\'%s\' AND t_note.note_share=1)) AND ", ptr_clrequest->username, ptr_clrequest->username); } } Index: backendn-notex.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/backendn-notex.c,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -u -U2 -r1.8.2.4 -r1.8.2.5 --- backendn-notex.c 19 Sep 2005 20:10:29 -0000 1.8.2.4 +++ backendn-notex.c 23 Sep 2005 23:48:34 -0000 1.8.2.5 @@ -128,4 +128,5 @@ const char* citem; const char* owner; + short int share; char* item; char* new_ref; @@ -163,7 +164,16 @@ } + share = get_refdb_note_share(ptr_rendinfo->dbires); + if (*id) { - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "xnote", "id", id, "citekey", citem, "user", owner, "date", date_buffer, 0, &xindent) == NULL) { + if (share != -1) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "xnote", "id", id, "citekey", citem, "user", owner, "date", date_buffer, "share", (share == 1) ? "public":"private", 0, &xindent) == NULL) { + return 801; + } + } + else { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "xnote", "id", id, "citekey", citem, "user", owner, "date", date_buffer, NULL, NULL, 0, &xindent) == NULL) { return 801; + } } } @@ -196,5 +206,5 @@ item = get_refdb_note_content_copy(ptr_rendinfo->dbires); if (item != NULL) { - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "content", "type", get_refdb_note_content_type(ptr_rendinfo->dbires), "xml:lang", get_refdb_note_content_xmllang(ptr_rendinfo->dbires), NULL, NULL, NULL, NULL, 0, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "content", "type", get_refdb_note_content_type(ptr_rendinfo->dbires), "xml:lang", get_refdb_note_content_xmllang(ptr_rendinfo->dbires), NULL, NULL, NULL, NULL, NULL, NULL, 0, &xindent) == NULL) { free(item); return 801; @@ -249,20 +259,20 @@ if (i == 3) { /* periodical */ if (!mode) { /* full name */ - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalfull", "target", citem, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalfull", "target", citem, NULL, NULL, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { return 801; } } else if (mode == 1) { /* abbrev */ - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalabbrev", "target", citem, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalabbrev", "target", citem, NULL, NULL, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { return 801; } } else if (mode == 2) { /* custabbrev 1 */ - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalcustabbrev1", "target", citem, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalcustabbrev1", "target", citem, NULL, NULL, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { return 801; } } else if (mode == 3) { /* custabbrev 2 */ - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalcustabbrev2", "target", citem, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", "journalcustabbrev2", "target", citem, NULL, NULL, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { return 801; } @@ -270,5 +280,5 @@ } else { - if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", linktype[i], "target", citem, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { + if (print_elstart_x(ptr_rendinfo->ptr_ref, ptr_rendinfo->ptr_ref_len, "link", "type", linktype[i], "target", citem, NULL, NULL, NULL, NULL, NULL, NULL, 1, &xindent) == NULL) { return 801; } |