683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
|
db_finalize(&q);
}
/*
** COMMAND: attachment*
**
** Usage: %fossil attachment add ?PAGENAME? FILENAME [-t|--technote DATETIME ]
**
** Add an attachment to an existing wiki page or tech note. One of
** PAGENAME or DATETIME must be specified.
**
*/
void attachment_cmd(void){
int n;
db_find_and_open_repository(0, 0);
if( g.argc<3 ){
goto attachment_cmd_usage;
}
|
|
|
>
|
>
>
>
>
>
>
>
>
|
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
|
db_finalize(&q);
}
/*
** COMMAND: attachment*
**
** Usage: %fossil attachment add ?PAGENAME? FILENAME ?OPTIONS?
**
** Add an attachment to an existing wiki page or tech note.
**
** Options:
** -t|--technote DATETIME Specifies the timestamp of
** the technote to which the attachment
** is to be made. The attachment will be
** to the most recently modified tech note
** with the specified timestamp.
** -t|--technote TECHNOTE-ID Specifies the technote to be
** updated by its technote id.
**
** One of PAGENAME, DATETIME or TECHNOTE-ID must be specified.
*/
void attachment_cmd(void){
int n;
db_find_and_open_repository(0, 0);
if( g.argc<3 ){
goto attachment_cmd_usage;
}
|
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
|
if( zBody==0 ){
fossil_fatal("wiki page [%s] not found",zPageName);
}
zTarget = zPageName;
zFile = g.argv[4];
}else{
if( g.argc!=4 ){
usage("add FILENAME --technote DATETIME");
}
rid = db_int(0, "SELECT objid FROM event"
" WHERE datetime(mtime)=datetime('%q') AND type='e'"
" ORDER BY mtime DESC LIMIT 1",
zETime
);
if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){
zBody = pWiki->zWiki;
}
if( zBody==0 ){
fossil_fatal("technote [%s] not found",zETime);
}
zTarget = db_text(0,
|
|
<
<
<
|
|
>
>
|
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
|
if( zBody==0 ){
fossil_fatal("wiki page [%s] not found",zPageName);
}
zTarget = zPageName;
zFile = g.argv[4];
}else{
if( g.argc!=4 ){
usage("add FILENAME --technote DATETIME|TECHNOTE-ID");
}
rid = wiki_technote_to_rid(zETime);
if( rid<0 ){
fossil_fatal("ambiguous tech note id: %s", zETime);
}
if( (pWiki = manifest_get(rid, CFTYPE_EVENT, 0))!=0 ){
zBody = pWiki->zWiki;
}
if( zBody==0 ){
fossil_fatal("technote [%s] not found",zETime);
}
zTarget = db_text(0,
|