Fossil SCM

implement undocumented "mionly" option in JSON timeline, just as in the normal timeline page.

jan.nijtmans 2013-09-12 22:47 trunk
Commit 0bcb7707cee102ffeae56e53a263cffa32708b5f
1 file changed +6 -4
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -124,11 +124,11 @@
124124
**
125125
** tag works like HTML mode's "t" option and branch works like HTML
126126
** mode's "r" option. They are very similar, but subtly different -
127127
** tag mode shows only entries with a given tag but branch mode can
128128
** also reveal some with "related" tags (meaning they were merged into
129
-** the requested branch).
129
+** the requested branch, or back).
130130
**
131131
** pSql is the target blob to append the query [subset]
132132
** to.
133133
**
134134
** Returns a positive value if it modifies pSql, 0 if it
@@ -144,10 +144,11 @@
144144
*/
145145
static char json_timeline_add_tag_branch_clause(Blob *pSql,
146146
cson_object * pPayload){
147147
char const * zTag = NULL;
148148
char const * zBranch = NULL;
149
+ char const * zMiOnly = NULL;
149150
int tagid = 0;
150151
if(! g.perm.Read ){
151152
return 0;
152153
}
153154
zTag = json_find_option_cstr("tag",NULL,NULL);
@@ -155,10 +156,11 @@
155156
zBranch = json_find_option_cstr("branch",NULL,NULL);
156157
if(!zBranch || !*zBranch){
157158
return 0;
158159
}
159160
zTag = zBranch;
161
+ zMiOnly = json_find_option_cstr("mionly",NULL,NULL);
160162
}
161163
tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",
162164
zTag);
163165
if(tagid<=0){
164166
return -1;
@@ -175,16 +177,16 @@
175177
/* from "r" flag code in page_timeline().*/
176178
blob_appendf(pSql,
177179
" OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
178180
" WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)",
179181
tagid);
180
-#if 0 /* from the undocumented "mionly" flag in page_timeline() */
181
- blob_appendf(pSql,
182
+ if( zMiOnly==0 ){
183
+ blob_appendf(pSql,
182184
" OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
183185
" WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)",
184186
tagid);
185
-#endif
187
+ }
186188
}
187189
blob_append(pSql," ) ",3);
188190
return 1;
189191
}
190192
/*
191193
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -124,11 +124,11 @@
124 **
125 ** tag works like HTML mode's "t" option and branch works like HTML
126 ** mode's "r" option. They are very similar, but subtly different -
127 ** tag mode shows only entries with a given tag but branch mode can
128 ** also reveal some with "related" tags (meaning they were merged into
129 ** the requested branch).
130 **
131 ** pSql is the target blob to append the query [subset]
132 ** to.
133 **
134 ** Returns a positive value if it modifies pSql, 0 if it
@@ -144,10 +144,11 @@
144 */
145 static char json_timeline_add_tag_branch_clause(Blob *pSql,
146 cson_object * pPayload){
147 char const * zTag = NULL;
148 char const * zBranch = NULL;
 
149 int tagid = 0;
150 if(! g.perm.Read ){
151 return 0;
152 }
153 zTag = json_find_option_cstr("tag",NULL,NULL);
@@ -155,10 +156,11 @@
155 zBranch = json_find_option_cstr("branch",NULL,NULL);
156 if(!zBranch || !*zBranch){
157 return 0;
158 }
159 zTag = zBranch;
 
160 }
161 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",
162 zTag);
163 if(tagid<=0){
164 return -1;
@@ -175,16 +177,16 @@
175 /* from "r" flag code in page_timeline().*/
176 blob_appendf(pSql,
177 " OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
178 " WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)",
179 tagid);
180 #if 0 /* from the undocumented "mionly" flag in page_timeline() */
181 blob_appendf(pSql,
182 " OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
183 " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)",
184 tagid);
185 #endif
186 }
187 blob_append(pSql," ) ",3);
188 return 1;
189 }
190 /*
191
--- src/json_timeline.c
+++ src/json_timeline.c
@@ -124,11 +124,11 @@
124 **
125 ** tag works like HTML mode's "t" option and branch works like HTML
126 ** mode's "r" option. They are very similar, but subtly different -
127 ** tag mode shows only entries with a given tag but branch mode can
128 ** also reveal some with "related" tags (meaning they were merged into
129 ** the requested branch, or back).
130 **
131 ** pSql is the target blob to append the query [subset]
132 ** to.
133 **
134 ** Returns a positive value if it modifies pSql, 0 if it
@@ -144,10 +144,11 @@
144 */
145 static char json_timeline_add_tag_branch_clause(Blob *pSql,
146 cson_object * pPayload){
147 char const * zTag = NULL;
148 char const * zBranch = NULL;
149 char const * zMiOnly = NULL;
150 int tagid = 0;
151 if(! g.perm.Read ){
152 return 0;
153 }
154 zTag = json_find_option_cstr("tag",NULL,NULL);
@@ -155,10 +156,11 @@
156 zBranch = json_find_option_cstr("branch",NULL,NULL);
157 if(!zBranch || !*zBranch){
158 return 0;
159 }
160 zTag = zBranch;
161 zMiOnly = json_find_option_cstr("mionly",NULL,NULL);
162 }
163 tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname='sym-%q'",
164 zTag);
165 if(tagid<=0){
166 return -1;
@@ -175,16 +177,16 @@
177 /* from "r" flag code in page_timeline().*/
178 blob_appendf(pSql,
179 " OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=cid"
180 " WHERE tagid=%d AND tagtype>0 AND pid=blob.rid)",
181 tagid);
182 if( zMiOnly==0 ){
183 blob_appendf(pSql,
184 " OR EXISTS(SELECT 1 FROM plink JOIN tagxref ON rid=pid"
185 " WHERE tagid=%d AND tagtype>0 AND cid=blob.rid)",
186 tagid);
187 }
188 }
189 blob_append(pSql," ) ",3);
190 return 1;
191 }
192 /*
193

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button