Fossil SCM

Initial sketch of the ability to upload a new /uv file via an HTML form, per off-list user request. The form is not yet handled.

stephan 2024-06-23 19:12 trunk
Commit 152cc642e7f95d61bc4d2b3c892b9bdb1c72695cb52a65fd4faead9a28d67e0a
--- src/main.mk
+++ src/main.mk
@@ -271,10 +271,11 @@
271271
$(SRCDIR)/sounds/f.wav \
272272
$(SRCDIR)/style.admin_log.css \
273273
$(SRCDIR)/style.chat.css \
274274
$(SRCDIR)/style.fileedit.css \
275275
$(SRCDIR)/style.pikchrshow.css \
276
+ $(SRCDIR)/style.uvlist.css \
276277
$(SRCDIR)/style.wikiedit.css \
277278
$(SRCDIR)/tree.js \
278279
$(SRCDIR)/useredit.js \
279280
$(SRCDIR)/wiki.wiki
280281
281282
282283
ADDED src/style.uvlist.css
--- src/main.mk
+++ src/main.mk
@@ -271,10 +271,11 @@
271 $(SRCDIR)/sounds/f.wav \
272 $(SRCDIR)/style.admin_log.css \
273 $(SRCDIR)/style.chat.css \
274 $(SRCDIR)/style.fileedit.css \
275 $(SRCDIR)/style.pikchrshow.css \
 
276 $(SRCDIR)/style.wikiedit.css \
277 $(SRCDIR)/tree.js \
278 $(SRCDIR)/useredit.js \
279 $(SRCDIR)/wiki.wiki
280
281
282 DDED src/style.uvlist.css
--- src/main.mk
+++ src/main.mk
@@ -271,10 +271,11 @@
271 $(SRCDIR)/sounds/f.wav \
272 $(SRCDIR)/style.admin_log.css \
273 $(SRCDIR)/style.chat.css \
274 $(SRCDIR)/style.fileedit.css \
275 $(SRCDIR)/style.pikchrshow.css \
276 $(SRCDIR)/style.uvlist.css \
277 $(SRCDIR)/style.wikiedit.css \
278 $(SRCDIR)/tree.js \
279 $(SRCDIR)/useredit.js \
280 $(SRCDIR)/wiki.wiki
281
282
283 DDED src/style.uvlist.css
--- a/src/style.uvlist.css
+++ b/src/style.uvlist.css
@@ -0,0 +1,3 @@
1
+body.uvlist form.uvupload label {
2
+ display: block;
3
+}
--- a/src/style.uvlist.css
+++ b/src/style.uvlist.css
@@ -0,0 +1,3 @@
 
 
 
--- a/src/style.uvlist.css
+++ b/src/style.uvlist.css
@@ -0,0 +1,3 @@
1 body.uvlist form.uvupload label {
2 display: block;
3 }
--- src/unversioned.c
+++ src/unversioned.c
@@ -520,10 +520,23 @@
520520
db_end_transaction(0);
521521
}else{
522522
usage("add|cat|edit|export|list|revert|remove|sync|touch");
523523
}
524524
}
525
+
526
+/*
527
+** Emit an HTML form for uploading a new unversioned file if
528
+** the current user has WrUnver permissions, else this is
529
+** a no-op.
530
+*/
531
+static void uv_form_upload(void){
532
+ if( !g.perm.WrUnver ) return;
533
+ CX("<form class='uvupload' method='POST'>");
534
+ CX("<label for='uvupload'>Select file to upload:</label>");
535
+ CX("<input type='file' id='uvupload' name='uvupload'/>");
536
+ CX("</form>");
537
+}
525538
526539
/*
527540
** WEBPAGE: uvlist
528541
**
529542
** Display a list of all unversioned files in the repository.
@@ -547,10 +560,11 @@
547560
cgi_check_for_malice();
548561
etag_check(ETAG_DATA,0);
549562
style_header("Unversioned Files");
550563
if( !db_table_exists("repository","unversioned") ){
551564
@ No unversioned files on this server
565
+ uv_form_upload();
552566
style_finish_page();
553567
return;
554568
}
555569
if( PB("byage") ) zOrderBy = "mtime DESC";
556570
if( PB("showdel") ) showDel = 1;
@@ -639,10 +653,11 @@
639653
@ </tfoot>
640654
@ </table></div>
641655
}else{
642656
@ No unversioned files on this server.
643657
}
658
+ uv_form_upload();
644659
style_finish_page();
645660
}
646661
647662
/*
648663
** WEBPAGE: juvlist
649664
--- src/unversioned.c
+++ src/unversioned.c
@@ -520,10 +520,23 @@
520 db_end_transaction(0);
521 }else{
522 usage("add|cat|edit|export|list|revert|remove|sync|touch");
523 }
524 }
 
 
 
 
 
 
 
 
 
 
 
 
 
525
526 /*
527 ** WEBPAGE: uvlist
528 **
529 ** Display a list of all unversioned files in the repository.
@@ -547,10 +560,11 @@
547 cgi_check_for_malice();
548 etag_check(ETAG_DATA,0);
549 style_header("Unversioned Files");
550 if( !db_table_exists("repository","unversioned") ){
551 @ No unversioned files on this server
 
552 style_finish_page();
553 return;
554 }
555 if( PB("byage") ) zOrderBy = "mtime DESC";
556 if( PB("showdel") ) showDel = 1;
@@ -639,10 +653,11 @@
639 @ </tfoot>
640 @ </table></div>
641 }else{
642 @ No unversioned files on this server.
643 }
 
644 style_finish_page();
645 }
646
647 /*
648 ** WEBPAGE: juvlist
649
--- src/unversioned.c
+++ src/unversioned.c
@@ -520,10 +520,23 @@
520 db_end_transaction(0);
521 }else{
522 usage("add|cat|edit|export|list|revert|remove|sync|touch");
523 }
524 }
525
526 /*
527 ** Emit an HTML form for uploading a new unversioned file if
528 ** the current user has WrUnver permissions, else this is
529 ** a no-op.
530 */
531 static void uv_form_upload(void){
532 if( !g.perm.WrUnver ) return;
533 CX("<form class='uvupload' method='POST'>");
534 CX("<label for='uvupload'>Select file to upload:</label>");
535 CX("<input type='file' id='uvupload' name='uvupload'/>");
536 CX("</form>");
537 }
538
539 /*
540 ** WEBPAGE: uvlist
541 **
542 ** Display a list of all unversioned files in the repository.
@@ -547,10 +560,11 @@
560 cgi_check_for_malice();
561 etag_check(ETAG_DATA,0);
562 style_header("Unversioned Files");
563 if( !db_table_exists("repository","unversioned") ){
564 @ No unversioned files on this server
565 uv_form_upload();
566 style_finish_page();
567 return;
568 }
569 if( PB("byage") ) zOrderBy = "mtime DESC";
570 if( PB("showdel") ) showDel = 1;
@@ -639,10 +653,11 @@
653 @ </tfoot>
654 @ </table></div>
655 }else{
656 @ No unversioned files on this server.
657 }
658 uv_form_upload();
659 style_finish_page();
660 }
661
662 /*
663 ** WEBPAGE: juvlist
664
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -657,10 +657,11 @@
657657
$(SRCDIR)/sounds/f.wav \
658658
$(SRCDIR)/style.admin_log.css \
659659
$(SRCDIR)/style.chat.css \
660660
$(SRCDIR)/style.fileedit.css \
661661
$(SRCDIR)/style.pikchrshow.css \
662
+ $(SRCDIR)/style.uvlist.css \
662663
$(SRCDIR)/style.wikiedit.css \
663664
$(SRCDIR)/tree.js \
664665
$(SRCDIR)/useredit.js \
665666
$(SRCDIR)/wiki.wiki
666667
667668
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -657,10 +657,11 @@
657 $(SRCDIR)/sounds/f.wav \
658 $(SRCDIR)/style.admin_log.css \
659 $(SRCDIR)/style.chat.css \
660 $(SRCDIR)/style.fileedit.css \
661 $(SRCDIR)/style.pikchrshow.css \
 
662 $(SRCDIR)/style.wikiedit.css \
663 $(SRCDIR)/tree.js \
664 $(SRCDIR)/useredit.js \
665 $(SRCDIR)/wiki.wiki
666
667
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -657,10 +657,11 @@
657 $(SRCDIR)/sounds/f.wav \
658 $(SRCDIR)/style.admin_log.css \
659 $(SRCDIR)/style.chat.css \
660 $(SRCDIR)/style.fileedit.css \
661 $(SRCDIR)/style.pikchrshow.css \
662 $(SRCDIR)/style.uvlist.css \
663 $(SRCDIR)/style.wikiedit.css \
664 $(SRCDIR)/tree.js \
665 $(SRCDIR)/useredit.js \
666 $(SRCDIR)/wiki.wiki
667
668
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -615,10 +615,11 @@
615615
"$(SRCDIR)\sounds\f.wav" \
616616
"$(SRCDIR)\style.admin_log.css" \
617617
"$(SRCDIR)\style.chat.css" \
618618
"$(SRCDIR)\style.fileedit.css" \
619619
"$(SRCDIR)\style.pikchrshow.css" \
620
+ "$(SRCDIR)\style.uvlist.css" \
620621
"$(SRCDIR)\style.wikiedit.css" \
621622
"$(SRCDIR)\tree.js" \
622623
"$(SRCDIR)\useredit.js" \
623624
"$(SRCDIR)\wiki.wiki"
624625
@@ -1244,10 +1245,11 @@
12441245
echo "$(SRCDIR)\sounds/f.wav" >> $@
12451246
echo "$(SRCDIR)\style.admin_log.css" >> $@
12461247
echo "$(SRCDIR)\style.chat.css" >> $@
12471248
echo "$(SRCDIR)\style.fileedit.css" >> $@
12481249
echo "$(SRCDIR)\style.pikchrshow.css" >> $@
1250
+ echo "$(SRCDIR)\style.uvlist.css" >> $@
12491251
echo "$(SRCDIR)\style.wikiedit.css" >> $@
12501252
echo "$(SRCDIR)\tree.js" >> $@
12511253
echo "$(SRCDIR)\useredit.js" >> $@
12521254
echo "$(SRCDIR)\wiki.wiki" >> $@
12531255
12541256
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -615,10 +615,11 @@
615 "$(SRCDIR)\sounds\f.wav" \
616 "$(SRCDIR)\style.admin_log.css" \
617 "$(SRCDIR)\style.chat.css" \
618 "$(SRCDIR)\style.fileedit.css" \
619 "$(SRCDIR)\style.pikchrshow.css" \
 
620 "$(SRCDIR)\style.wikiedit.css" \
621 "$(SRCDIR)\tree.js" \
622 "$(SRCDIR)\useredit.js" \
623 "$(SRCDIR)\wiki.wiki"
624
@@ -1244,10 +1245,11 @@
1244 echo "$(SRCDIR)\sounds/f.wav" >> $@
1245 echo "$(SRCDIR)\style.admin_log.css" >> $@
1246 echo "$(SRCDIR)\style.chat.css" >> $@
1247 echo "$(SRCDIR)\style.fileedit.css" >> $@
1248 echo "$(SRCDIR)\style.pikchrshow.css" >> $@
 
1249 echo "$(SRCDIR)\style.wikiedit.css" >> $@
1250 echo "$(SRCDIR)\tree.js" >> $@
1251 echo "$(SRCDIR)\useredit.js" >> $@
1252 echo "$(SRCDIR)\wiki.wiki" >> $@
1253
1254
--- win/Makefile.msc
+++ win/Makefile.msc
@@ -615,10 +615,11 @@
615 "$(SRCDIR)\sounds\f.wav" \
616 "$(SRCDIR)\style.admin_log.css" \
617 "$(SRCDIR)\style.chat.css" \
618 "$(SRCDIR)\style.fileedit.css" \
619 "$(SRCDIR)\style.pikchrshow.css" \
620 "$(SRCDIR)\style.uvlist.css" \
621 "$(SRCDIR)\style.wikiedit.css" \
622 "$(SRCDIR)\tree.js" \
623 "$(SRCDIR)\useredit.js" \
624 "$(SRCDIR)\wiki.wiki"
625
@@ -1244,10 +1245,11 @@
1245 echo "$(SRCDIR)\sounds/f.wav" >> $@
1246 echo "$(SRCDIR)\style.admin_log.css" >> $@
1247 echo "$(SRCDIR)\style.chat.css" >> $@
1248 echo "$(SRCDIR)\style.fileedit.css" >> $@
1249 echo "$(SRCDIR)\style.pikchrshow.css" >> $@
1250 echo "$(SRCDIR)\style.uvlist.css" >> $@
1251 echo "$(SRCDIR)\style.wikiedit.css" >> $@
1252 echo "$(SRCDIR)\tree.js" >> $@
1253 echo "$(SRCDIR)\useredit.js" >> $@
1254 echo "$(SRCDIR)\wiki.wiki" >> $@
1255
1256

Keyboard Shortcuts

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