@@ -557,9 +557,53 @@ export const schedulePane = {
557557 const showForms = function ( ) {
558558 clearElement ( naviCenter ) // Remove refresh button if nec
559559 const div = naviMain
560+
561+ // form2 depends on sched:allDay; seed a local default for new polls
562+ if ( ! kb . any ( subject , ns . sched ( 'allDay' ) ) ) {
563+ kb . add (
564+ subject ,
565+ ns . sched ( 'allDay' ) ,
566+ $rdf . literal (
567+ 'true' ,
568+ undefined ,
569+ $rdf . sym ( 'http://www.w3.org/2001/XMLSchema#boolean' )
570+ ) ,
571+ detailsDoc
572+ )
573+ }
574+
560575 const wizard = true
561576 let currentSlide = 0
562577 let gotDoneButton = false
578+
579+ const hasFormControls = function ( container ) {
580+ return ! ! container . querySelector ( 'input, select, textarea, button' )
581+ }
582+
583+ const asBoolean = function ( term , fallback ) {
584+ if ( ! term ) return fallback
585+ const value = ( term . value || '' ) . toLowerCase ( )
586+ if ( value === 'true' || value === '1' ) return true
587+ if ( value === 'false' || value === '0' ) return false
588+ return fallback
589+ }
590+
591+ const renderTimeProposalFallback = function ( slide ) {
592+ const allDayValue = asBoolean ( kb . any ( subject , ns . sched ( 'allDay' ) ) , true )
593+ const fallbackForm = kb . sym (
594+ formsURI + ( allDayValue ? '#AllDayForm2' : '#NotAllDayForm2' )
595+ )
596+ UI . widgets . appendForm (
597+ document ,
598+ slide ,
599+ { } ,
600+ subject ,
601+ fallbackForm ,
602+ detailsDoc ,
603+ complainIfBad
604+ )
605+ }
606+
563607 if ( wizard ) {
564608 const forms = [ form1 , form2 , form3 ]
565609 const slides = [ ]
@@ -575,6 +619,12 @@ export const schedulePane = {
575619 detailsDoc ,
576620 complainIfBad
577621 )
622+
623+ // Some stores end up with form2's ui:Options unresolved; force a usable input form.
624+ if ( f === 1 && ! hasFormControls ( slide ) ) {
625+ renderTimeProposalFallback ( slide )
626+ }
627+
578628 slides . push ( slide )
579629 }
580630
@@ -882,7 +932,7 @@ export const schedulePane = {
882932
883933 // Read or create empty results file
884934 function getResults ( ) {
885- fetcher . nowOrWhenFetched ( resultsDoc . uri , ( ok , body , response ) => {
935+ fetcher . nowOrWhenFetched ( resultsDoc . uri , undefined , ( ok , body , response ) => {
886936 if ( ! ok ) {
887937 if ( response . status === 404 ) {
888938 // / Check explicitly for 404 error
@@ -968,18 +1018,25 @@ export const schedulePane = {
9681018 options . set_x = kb . each ( subject , ns . sched ( 'option' ) ) // @@@@@ option -> dtstart in future
9691019 options . set_x = options . set_x . map ( function ( opt ) {
9701020 return kb . any ( opt , ns . cal ( 'dtstart' ) )
1021+ } ) . filter ( function ( time ) {
1022+ return ! ! time
9711023 } )
9721024
9731025 options . set_y = kb . each ( subject , ns . sched ( 'response' ) )
9741026 options . set_y = options . set_y . map ( function ( resp ) {
9751027 return kb . any ( resp , ns . dc ( 'author' ) )
1028+ } ) . filter ( function ( author ) {
1029+ return ! ! author
9761030 } )
9771031
9781032 const possibleTimes = kb
9791033 . each ( invitation , ns . sched ( 'option' ) )
9801034 . map ( function ( opt ) {
9811035 return kb . any ( opt , ns . cal ( 'dtstart' ) )
9821036 } )
1037+ . filter ( function ( time ) {
1038+ return ! ! time
1039+ } )
9831040
9841041 const displayTheMatrix = function ( ) {
9851042 const matrix = div . appendChild (
@@ -1055,6 +1112,7 @@ export const schedulePane = {
10551112 } // @@ may need that
10561113 const selectOptions = { }
10571114 const predicate = ns . sched ( 'availabilty' )
1115+ if ( ! x ) return
10581116 const cellSubject = dataPointForNT [ x . toNT ( ) ]
10591117 const selector = UI . widgets . makeSelectForOptions (
10601118 dom ,
@@ -1093,19 +1151,22 @@ export const schedulePane = {
10931151 const dps = kb . each ( myResponse , ns . sched ( 'cell' ) )
10941152 dps . forEach ( function ( dataPoint ) {
10951153 const time = kb . any ( dataPoint , ns . cal ( 'dtstart' ) )
1154+ if ( ! time ) return
10961155 dataPointForNT [ time . toNT ( ) ] = dataPoint
10971156 } )
10981157 }
10991158 for ( let j = 0 ; j < possibleTimes . length ; j ++ ) {
1100- if ( dataPointForNT [ possibleTimes [ j ] . toNT ( ) ] ) continue
1159+ const possibleTime = possibleTimes [ j ]
1160+ if ( ! possibleTime ) continue
1161+ if ( dataPointForNT [ possibleTime . toNT ( ) ] ) continue
11011162 const dataPoint = $rdf . sym ( id + '_' + j )
11021163 insertables . push (
11031164 $rdf . st ( myResponse , ns . sched ( 'cell' ) , dataPoint , doc )
11041165 )
11051166 insertables . push (
1106- $rdf . st ( dataPoint , ns . cal ( 'dtstart' ) , possibleTimes [ j ] , doc )
1167+ $rdf . st ( dataPoint , ns . cal ( 'dtstart' ) , possibleTime , doc )
11071168 ) // @@
1108- dataPointForNT [ possibleTimes [ j ] . toNT ( ) ] = dataPoint
1169+ dataPointForNT [ possibleTime . toNT ( ) ] = dataPoint
11091170 }
11101171 if ( insertables . length ) {
11111172 kb . updater . update ( [ ] , insertables , function (
0 commit comments