Fossil

Check-in [0e924820]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tidy up tagview code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | eric-tagview-rework | trunk
Files: files | file ages | folders
SHA1:0e924820bffe17d305c7f64c05a4f6eed65f169e
User & Date: eric 2008-08-24 20:16:43
Context
2008-09-03
18:52
Clarify some comments in name.c check-in: 5113ab59 user: eric tags: eric-tagview-rework, trunk
2008-08-24
20:16
Tidy up tagview code. check-in: 0e924820 user: eric tags: eric-tagview-rework, trunk
2008-08-21
20:59
Include non-sym- tags in tagview web page. Also merge mainline into tagview branch. check-in: 5fb14b9a user: eric tags: eric-tagview-rework, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/name.c.

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  db_prepare(&q,
    "SELECT (SELECT uuid FROM blob WHERE rid=objid)"
    "  FROM tagxref JOIN event ON rid=objid"
    " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q||%Q)"
    "   AND tagtype>0"
    "   AND value IS NULL"
    " ORDER BY event.mtime DESC",
	pPrefix,
    pName
  );
  blob_zero(pUuid);
  while( db_step(&q)==SQLITE_ROW ){
    count++;
    if(count>1){
      break;
................................................................................
    }
    db_column_blob(&q, 0, pUuid);
  }
  db_finalize(&q);
  return count;
}
int sym_tag_to_uuid(const char *pName, Blob *pUuid){
	return tag_to_uuid(pName,pUuid,"sym-");
}

/*
** COMMAND:  test-name-to-uuid
**
** Convert a name to a full UUID.
*/







|







 







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  db_prepare(&q,
    "SELECT (SELECT uuid FROM blob WHERE rid=objid)"
    "  FROM tagxref JOIN event ON rid=objid"
    " WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q||%Q)"
    "   AND tagtype>0"
    "   AND value IS NULL"
    " ORDER BY event.mtime DESC",
    pPrefix,
    pName
  );
  blob_zero(pUuid);
  while( db_step(&q)==SQLITE_ROW ){
    count++;
    if(count>1){
      break;
................................................................................
    }
    db_column_blob(&q, 0, pUuid);
  }
  db_finalize(&q);
  return count;
}
int sym_tag_to_uuid(const char *pName, Blob *pUuid){
    return tag_to_uuid(pName,pUuid,"sym-");
}

/*
** COMMAND:  test-name-to-uuid
**
** Convert a name to a full UUID.
*/

Changes to src/tagview.c.

156
157
158
159
160
161
162





















163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
...
237
238
239
240
241
242
243
244
245
  }else if( 0 != (check = P("name")) ){
    tagview_page_tag_by_name( check );
  }else{
    tagview_page_default();
  }
  style_footer();
}






















/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;
    char *zSql;
    Stmt q;
    if( sym_tag_to_uuid(zName, &uuid) > 0){
      style_header("Tagged Baselines");
      @ <h2>%s(zName):</h2>
      zSql = mprintf("%s AND EXISTS (SELECT 1"
             " FROM tagxref"
             "  WHERE tagxref.rid = event.objid"
             "  AND tagxref.tagid = (SELECT tagid FROM tag"
             "      WHERE tagname = 'sym-'||%Q))"
             " ORDER BY 3 desc",
             timeline_query_for_www(), zName);
      db_prepare(&q, zSql);
      free(zSql);

      www_print_timeline(&q);
      db_finalize(&q);
    }else if( tag_to_uuid(zName, &uuid, "") > 0){
      style_header("Tagged Baselines");
      @ <h2>%s(zName):</h2>
      zSql = mprintf("%s AND EXISTS (SELECT 1"
             " FROM tagxref"
             "  WHERE tagxref.rid = event.objid"
             "  AND tagxref.tagid = (SELECT tagid FROM tag"
             "      WHERE tagname = %Q))"
             " ORDER BY 3 desc",
             timeline_query_for_www(), zName);
      db_prepare(&q, zSql);
      free(zSql);
      www_print_timeline(&q);
      db_finalize(&q);
    }else{
      style_header("TaggedBaselines");
      @ <h2>%s(zName):</h2>
      @ There is no artifact with this tag.
    }
  }else{
    Stmt q;
    const char *prefix = "sym-";
    int preflen = strlen(prefix);
    style_header("Tags");
................................................................................
      }
    }
    @ </ul>
    db_finalize(&q);
  }
  style_footer();
}

#undef TAGVIEW_DEFAULT_FILTER







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













<
<
<
|
|
<
<
<
<
<
<
<
<
<
>
|
<

<
<
<
<
<
<
<
<
<
<
<
|
<

<
<







 







<
<
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196



197
198









199
200

201











202

203


204
205
206
207
208
209
210
...
232
233
234
235
236
237
238


  }else if( 0 != (check = P("name")) ){
    tagview_page_tag_by_name( check );
  }else{
    tagview_page_default();
  }
  style_footer();
}

#undef TAGVIEW_DEFAULT_FILTER

/*
** Generate a timeline for the chosen tag
*/
void tagview_print_timeline(char const *pName, char const *pPrefix){
  char *zSql;
  Stmt q;
  zSql = mprintf("%s AND EXISTS (SELECT 1"
         " FROM tagxref"
         "  WHERE tagxref.rid = event.objid"
         "  AND tagxref.tagid = (SELECT tagid FROM tag"
         "      WHERE tagname = %Q||%Q))"
         " ORDER BY 3 desc",
         timeline_query_for_www(), pPrefix, pName);
  db_prepare(&q, zSql);
  free(zSql);
  www_print_timeline(&q);
  db_finalize(&q);
}

/*
** WEBPAGE: /tagview
*/
void tagview_page(void){
  char const *zName = 0;
  login_check_credentials();
  if( !g.okRead ){
    login_needed();
  }
  login_anonymous_available();
  if( 0 != (zName = P("name")) ){
    Blob uuid;



    style_header("Tagged Baselines");
    @ <h2>%s(zName):</h2>









    if( sym_tag_to_uuid(zName, &uuid) > 0){
      tagview_print_timeline(zName, "sym-");

    }else if( tag_to_uuid(zName, &uuid, "") > 0){











      tagview_print_timeline(zName, "");

    }else{


      @ There is no artifact with this tag.
    }
  }else{
    Stmt q;
    const char *prefix = "sym-";
    int preflen = strlen(prefix);
    style_header("Tags");
................................................................................
      }
    }
    @ </ul>
    db_finalize(&q);
  }
  style_footer();
}