| | @@ -361,11 +361,11 @@ |
| 361 | 361 | const char *zMime; /* MIME Type */ |
| 362 | 362 | Blob attach; /* Content of the attachment */ |
| 363 | 363 | int wantToDelete = P("del")!=0;/* Want to delete */ |
| 364 | 364 | |
| 365 | 365 | login_check_credentials(); |
| 366 | | - if( !g.perm.Attach ){ login_needed(); return; } |
| 366 | + if( !g.perm.RdTkt && !g.perm.RdWiki ){ login_needed(); return; } |
| 367 | 367 | rid = name_to_rid_www("name"); |
| 368 | 368 | if( rid==0 ){ fossil_redirect_home(); } |
| 369 | 369 | zUuid = db_text("", "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 370 | 370 | #if 0 |
| 371 | 371 | /* Shunning here needs to get both the attachment control artifact and |
| | @@ -389,12 +389,20 @@ |
| 389 | 389 | zDesc = pAttach->zComment; |
| 390 | 390 | if( validate16(zTarget, strlen(zTarget)) |
| 391 | 391 | && db_exists("SELECT 1 FROM ticket WHERE tkt_uuid='%s'", zTarget) |
| 392 | 392 | ){ |
| 393 | 393 | zTktUuid = zTarget; |
| 394 | + if( !g.perm.RdTkt ){ login_needed(); return; } |
| 395 | + if( g.perm.WrTkt ){ |
| 396 | + style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid); |
| 397 | + } |
| 394 | 398 | }else if( db_exists("SELECT 1 FROM tag WHERE tagname='wiki-%q'",zTarget) ){ |
| 395 | 399 | zWikiName = zTarget; |
| 400 | + if( !g.perm.RdWiki ){ login_needed(); return; } |
| 401 | + if( g.perm.WrWiki ){ |
| 402 | + style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid); |
| 403 | + } |
| 396 | 404 | } |
| 397 | 405 | zDate = db_text(0, "SELECT datetime(%.12f)", pAttach->rDate); |
| 398 | 406 | |
| 399 | 407 | if( P("confirm") |
| 400 | 408 | && ((zTktUuid && g.perm.WrTkt) || (zWikiName && g.perm.WrWiki)) |
| | @@ -463,20 +471,14 @@ |
| 463 | 471 | @ <span class="modpending">*** Awaiting Moderator Approval ***</span> |
| 464 | 472 | } |
| 465 | 473 | if( zTktUuid ){ |
| 466 | 474 | @ <tr><th>Ticket:</th> |
| 467 | 475 | @ <td>%z(href("%R/tktview/%s",zTktUuid))%s(zTktUuid)</a></td></tr> |
| 468 | | - if( g.perm.WrTkt ){ |
| 469 | | - style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid); |
| 470 | | - } |
| 471 | 476 | } |
| 472 | 477 | if( zWikiName ){ |
| 473 | 478 | @ <tr><th>Wiki Page:</th> |
| 474 | 479 | @ <td>%z(href("%R/wiki?name=%t",zWikiName))%h(zWikiName)</a></td></tr> |
| 475 | | - if( g.perm.WrWiki ){ |
| 476 | | - style_submenu_element("Delete","Delete","%R/ainfo/%s?del", zUuid); |
| 477 | | - } |
| 478 | 480 | } |
| 479 | 481 | @ <tr><th>Date:</th><td> |
| 480 | 482 | hyperlink_to_date(zDate, "</td></tr>"); |
| 481 | 483 | free(zDate); |
| 482 | 484 | @ <tr><th>User:</th><td> |
| | @@ -544,11 +546,11 @@ |
| 544 | 546 | ){ |
| 545 | 547 | int cnt = 0; |
| 546 | 548 | Stmt q; |
| 547 | 549 | db_prepare(&q, |
| 548 | 550 | "SELECT datetime(mtime,'localtime'), filename, user," |
| 549 | | - " (SELECT uuid FROM blob WHERE rid=attachid)" |
| 551 | + " (SELECT uuid FROM blob WHERE rid=attachid), src" |
| 550 | 552 | " FROM attachment" |
| 551 | 553 | " WHERE isLatest AND src!='' AND target=%Q" |
| 552 | 554 | " ORDER BY mtime DESC", |
| 553 | 555 | zTarget |
| 554 | 556 | ); |
| | @@ -555,16 +557,17 @@ |
| 555 | 557 | while( db_step(&q)==SQLITE_ROW ){ |
| 556 | 558 | const char *zDate = db_column_text(&q, 0); |
| 557 | 559 | const char *zFile = db_column_text(&q, 1); |
| 558 | 560 | const char *zUser = db_column_text(&q, 2); |
| 559 | 561 | const char *zUuid = db_column_text(&q, 3); |
| 562 | + const char *zSrc = db_column_text(&q, 4); |
| 560 | 563 | if( cnt==0 ){ |
| 561 | 564 | @ %s(zHeader) |
| 562 | 565 | } |
| 563 | 566 | cnt++; |
| 564 | 567 | @ <li> |
| 565 | | - @ %z(href("%R/artifact/%s",zUuid))%h(zFile)</a> |
| 568 | + @ %z(href("%R/artifact/%s",zSrc))%h(zFile)</a> |
| 566 | 569 | @ added by %h(zUser) on |
| 567 | 570 | hyperlink_to_date(zDate, "."); |
| 568 | 571 | @ [%z(href("%R/ainfo/%s",zUuid))details</a>] |
| 569 | 572 | @ </li> |
| 570 | 573 | } |
| 571 | 574 | |