-rw-r--r-- | ui-shared.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c index e991799..c99bcec 100644 --- a/ui-shared.c +++ b/ui-shared.c | |||
@@ -312,105 +312,119 @@ void cgit_log_link(const char *name, const char *title, const char *class, | |||
312 | if (showmsg) { | 312 | if (showmsg) { |
313 | html(delim); | 313 | html(delim); |
314 | html("showmsg=1"); | 314 | html("showmsg=1"); |
315 | } | 315 | } |
316 | html("'>"); | 316 | html("'>"); |
317 | html_txt(name); | 317 | html_txt(name); |
318 | html("</a>"); | 318 | html("</a>"); |
319 | } | 319 | } |
320 | 320 | ||
321 | void cgit_commit_link(char *name, const char *title, const char *class, | 321 | void cgit_commit_link(char *name, const char *title, const char *class, |
322 | const char *head, const char *rev, const char *path, | 322 | const char *head, const char *rev, const char *path, |
323 | int toggle_ssdiff) | 323 | int toggle_ssdiff) |
324 | { | 324 | { |
325 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { | 325 | if (strlen(name) > ctx.cfg.max_msg_len && ctx.cfg.max_msg_len >= 15) { |
326 | name[ctx.cfg.max_msg_len] = '\0'; | 326 | name[ctx.cfg.max_msg_len] = '\0'; |
327 | name[ctx.cfg.max_msg_len - 1] = '.'; | 327 | name[ctx.cfg.max_msg_len - 1] = '.'; |
328 | name[ctx.cfg.max_msg_len - 2] = '.'; | 328 | name[ctx.cfg.max_msg_len - 2] = '.'; |
329 | name[ctx.cfg.max_msg_len - 3] = '.'; | 329 | name[ctx.cfg.max_msg_len - 3] = '.'; |
330 | } | 330 | } |
331 | 331 | ||
332 | char *delim; | 332 | char *delim; |
333 | 333 | ||
334 | delim = repolink(title, class, "commit", head, path); | 334 | delim = repolink(title, class, "commit", head, path); |
335 | if (rev && strcmp(rev, ctx.qry.head)) { | 335 | if (rev && strcmp(rev, ctx.qry.head)) { |
336 | html(delim); | 336 | html(delim); |
337 | html("id="); | 337 | html("id="); |
338 | html_url_arg(rev); | 338 | html_url_arg(rev); |
339 | delim = "&"; | 339 | delim = "&"; |
340 | } | 340 | } |
341 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 341 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
342 | html(delim); | 342 | html(delim); |
343 | html("ss=1"); | 343 | html("ss=1"); |
344 | delim = "&"; | ||
345 | } | ||
346 | if (ctx.qry.context > 0 && ctx.qry.context != 3) { | ||
347 | html(delim); | ||
348 | html("context="); | ||
349 | htmlf("%d", ctx.qry.context); | ||
350 | delim = "&"; | ||
344 | } | 351 | } |
345 | html("'>"); | 352 | html("'>"); |
346 | html_txt(name); | 353 | html_txt(name); |
347 | html("</a>"); | 354 | html("</a>"); |
348 | } | 355 | } |
349 | 356 | ||
350 | void cgit_refs_link(const char *name, const char *title, const char *class, | 357 | void cgit_refs_link(const char *name, const char *title, const char *class, |
351 | const char *head, const char *rev, const char *path) | 358 | const char *head, const char *rev, const char *path) |
352 | { | 359 | { |
353 | reporevlink("refs", name, title, class, head, rev, path); | 360 | reporevlink("refs", name, title, class, head, rev, path); |
354 | } | 361 | } |
355 | 362 | ||
356 | void cgit_snapshot_link(const char *name, const char *title, const char *class, | 363 | void cgit_snapshot_link(const char *name, const char *title, const char *class, |
357 | const char *head, const char *rev, | 364 | const char *head, const char *rev, |
358 | const char *archivename) | 365 | const char *archivename) |
359 | { | 366 | { |
360 | reporevlink("snapshot", name, title, class, head, rev, archivename); | 367 | reporevlink("snapshot", name, title, class, head, rev, archivename); |
361 | } | 368 | } |
362 | 369 | ||
363 | void cgit_diff_link(const char *name, const char *title, const char *class, | 370 | void cgit_diff_link(const char *name, const char *title, const char *class, |
364 | const char *head, const char *new_rev, const char *old_rev, | 371 | const char *head, const char *new_rev, const char *old_rev, |
365 | const char *path, int toggle_ssdiff) | 372 | const char *path, int toggle_ssdiff) |
366 | { | 373 | { |
367 | char *delim; | 374 | char *delim; |
368 | 375 | ||
369 | delim = repolink(title, class, "diff", head, path); | 376 | delim = repolink(title, class, "diff", head, path); |
370 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { | 377 | if (new_rev && ctx.qry.head != NULL && strcmp(new_rev, ctx.qry.head)) { |
371 | html(delim); | 378 | html(delim); |
372 | html("id="); | 379 | html("id="); |
373 | html_url_arg(new_rev); | 380 | html_url_arg(new_rev); |
374 | delim = "&"; | 381 | delim = "&"; |
375 | } | 382 | } |
376 | if (old_rev) { | 383 | if (old_rev) { |
377 | html(delim); | 384 | html(delim); |
378 | html("id2="); | 385 | html("id2="); |
379 | html_url_arg(old_rev); | 386 | html_url_arg(old_rev); |
380 | delim = "&"; | 387 | delim = "&"; |
381 | } | 388 | } |
382 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { | 389 | if ((ctx.qry.ssdiff && !toggle_ssdiff) || (!ctx.qry.ssdiff && toggle_ssdiff)) { |
383 | html(delim); | 390 | html(delim); |
384 | html("ss=1"); | 391 | html("ss=1"); |
392 | delim = "&"; | ||
393 | } | ||
394 | if (ctx.qry.context > 0 && ctx.qry.context != 3) { | ||
395 | html(delim); | ||
396 | html("context="); | ||
397 | htmlf("%d", ctx.qry.context); | ||
398 | delim = "&"; | ||
385 | } | 399 | } |
386 | html("'>"); | 400 | html("'>"); |
387 | html_txt(name); | 401 | html_txt(name); |
388 | html("</a>"); | 402 | html("</a>"); |
389 | } | 403 | } |
390 | 404 | ||
391 | void cgit_patch_link(const char *name, const char *title, const char *class, | 405 | void cgit_patch_link(const char *name, const char *title, const char *class, |
392 | const char *head, const char *rev, const char *path) | 406 | const char *head, const char *rev, const char *path) |
393 | { | 407 | { |
394 | reporevlink("patch", name, title, class, head, rev, path); | 408 | reporevlink("patch", name, title, class, head, rev, path); |
395 | } | 409 | } |
396 | 410 | ||
397 | void cgit_stats_link(const char *name, const char *title, const char *class, | 411 | void cgit_stats_link(const char *name, const char *title, const char *class, |
398 | const char *head, const char *path) | 412 | const char *head, const char *path) |
399 | { | 413 | { |
400 | reporevlink("stats", name, title, class, head, NULL, path); | 414 | reporevlink("stats", name, title, class, head, NULL, path); |
401 | } | 415 | } |
402 | 416 | ||
403 | void cgit_self_link(char *name, const char *title, const char *class, | 417 | void cgit_self_link(char *name, const char *title, const char *class, |
404 | struct cgit_context *ctx) | 418 | struct cgit_context *ctx) |
405 | { | 419 | { |
406 | if (!strcmp(ctx->qry.page, "repolist")) | 420 | if (!strcmp(ctx->qry.page, "repolist")) |
407 | return cgit_index_link(name, title, class, ctx->qry.search, | 421 | return cgit_index_link(name, title, class, ctx->qry.search, |
408 | ctx->qry.ofs); | 422 | ctx->qry.ofs); |
409 | else if (!strcmp(ctx->qry.page, "summary")) | 423 | else if (!strcmp(ctx->qry.page, "summary")) |
410 | return cgit_summary_link(name, title, class, ctx->qry.head); | 424 | return cgit_summary_link(name, title, class, ctx->qry.head); |
411 | else if (!strcmp(ctx->qry.page, "tag")) | 425 | else if (!strcmp(ctx->qry.page, "tag")) |
412 | return cgit_tag_link(name, title, class, ctx->qry.head, | 426 | return cgit_tag_link(name, title, class, ctx->qry.head, |
413 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); | 427 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL); |
414 | else if (!strcmp(ctx->qry.page, "tree")) | 428 | else if (!strcmp(ctx->qry.page, "tree")) |
415 | return cgit_tree_link(name, title, class, ctx->qry.head, | 429 | return cgit_tree_link(name, title, class, ctx->qry.head, |
416 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, | 430 | ctx->qry.has_sha1 ? ctx->qry.sha1 : NULL, |