Re: [Ur] Ur/Web people organizer: editable table with fixed (hidden) field?
While in the long run something as general as what Ziv suggested is desirable I decided to experiment with the seemingly simpler idea of a hidden widget used with an unchanged version of EditableTable. Here is an example structure Theme = Ui.Make(Default) cookie userC : string table blocked : { User : string, Weekday : string, StartTime : string, CompleteTime : string } PRIMARY KEY (User, Weekday, StartTime) open Widget fun pad (n : int) : string = (if n < 10 then "0" else "") ^ show n fun twelveHour (h : int) (m : int) : string = let val ampm = if h < 12 then " am" else " pm" val hr = if h > 12 then h - 12 else h in pad hr ^ ":" ^ pad m ^ ampm end fun timeSlots (h : int) (lastH : int) : list string = let fun loop (acc : list string) (h : int) (lastH : int) = if h <= lastH then loop (twelveHour h 30 :: twelveHour h 0 :: acc) (h + 1) lastH else List.rev acc in loop [] h lastH end fun head [a] (ls : list a) : a = case ls of x :: _ => x | _ => error head of empty list fun tail [a] (ls : list a) : list a = case ls of _ :: ls' => ls' | _ => error tail of empty list fun withUser [t ::: Type] (action : string -> transaction t) : transaction t = user <- getCookie userC; case user of None => error cookie not set! | Some u => action u structure ET = EditableTable.Make( struct val tab = blocked val labels = {User = "", Weekday = "weekday", StartTime = "start time", CompleteTime = "end time"} val permission = return {Add = True, Delete = True, Modify = True} val widgets = let val timeSlots = timeSlots 7 21 val ht = head timeSlots val tt = tail timeSlots in {User = Widget.make { Configure = return (), Create = fn () => withUser source, Initialize = fn () => source, Reset = fn s => withUser (set s), AsWidget = fn s ido => case ido of None => | Some id => {[id]}, Value = signal, AsValue = fn _ => }, Weekday = choicebox "Sunday" ("Monday" :: "Tuesday" :: "Wednesday" :: "Thursday" :: "Friday" :: "Saturday" :: []), StartTime = choicebox ht tt, CompleteTime = choicebox ht tt } ++ _ end fun onAdd _ = return () fun onDelete _ = return () fun onModify _ = return () end) val main = setCookie userC {Value = "marko", Expires = None, Secure = False}; Theme.simple "Main" ET.ui On Thu, 13 Apr 2017 15:14:29 -0400, Adam Chlipala wrote: > > It seems the outcome is that someone would need to add this feature, but it's > probably along the lines of > code already present for other modules. > > On 04/11/2017 01:47 PM, Marko Schütz Schmuck wrote: > > On Tue, 11 Apr 2017 13:13:19 -0400, > Ziv Scully wrote: > > Am I correct in thinking that you basically want something like > InputStrings's "const" and "given" > parameters, but for EditableTable? > > Yes, from what I can tell... > > On Tue, Apr 11, 2017 at 13:03 Marko Schütz Schmuck >wrote: > > On Tue, 11 Apr 2017 12:18:59 -0400, > Adam Chlipala wrote: > > > > If the "user" field is not editable, how do you choose which > user to associate with a new row? > > I was thinking that it could be a transaction argument to the > widget > function like > > ... > val widgets = {User = sinkWidget (getCookie userC), ...} > > alternatively maybe it should be another part of the struct > passed to > the EditableTable.Make functor like "permission"? > > Best regards, > > Marko > > > On 04/11/2017 12:10 PM, Marko Schütz Schmuck wrote: > > > > On Tue, 11 Apr 2017 10:58:31 -0400, > > Adam Chlipala wrote: > > > > OK, so you don't want to support adding or deleting > rows, just editing the ones that > > already exist? I'm not sure UPO has something like > that right now, but I'd need to look > > through the code again to be
Re: [Ur] Ur/Web people organizer: editable table with fixed (hidden) field?
I have started looking into that, but don't expect anything soon... It'll take me some time just to understand the existing code. On Apr 13, 2017 3:15 PM, "Adam Chlipala"wrote: > It seems the outcome is that someone would need to add this feature, but > it's probably along the lines of code already present for other modules. > On 04/11/2017 01:47 PM, Marko Schütz Schmuck wrote: > > On Tue, 11 Apr 2017 13:13:19 -0400, > Ziv Scully wrote: > > > Am I correct in thinking that you basically want something like > InputStrings's "const" and "given" > parameters, but for EditableTable? > > > Yes, from what I can tell... > > > On Tue, Apr 11, 2017 at 13:03 Marko Schütz Schmuck > wrote: > > On Tue, 11 Apr 2017 12:18:59 -0400, > Adam Chlipala wrote: > > > > If the "user" field is not editable, how do you choose which user to > associate with a new row? > > I was thinking that it could be a transaction argument to the widget > function like > > ... > val widgets = {User = sinkWidget (getCookie userC), ...} > > alternatively maybe it should be another part of the struct passed to > the EditableTable.Make functor like "permission"? > > Best regards, > > Marko > > > On 04/11/2017 12:10 PM, Marko Schütz Schmuck wrote: > > > > On Tue, 11 Apr 2017 10:58:31 -0400, > > Adam Chlipala wrote: > > > > OK, so you don't want to support adding or deleting rows, just > editing the ones that > > already exist? I'm not sure UPO has something like that right > now, but I'd need to look > > through the code again to be sure. > > > > No, no: adding and deleting are required too. It's just that I want > to > > have the User field not editable. A "sink widget" that does not > > display but can be assigned as the widget of a field might work? The > > field would still be in the records and be stored in the table. > > > > Best regards, > > > > Marko > > > > On 04/10/2017 04:14 PM, Marko Schütz Schmuck wrote: > > > > I was wondering whether the tools available in UPO are > already > > sufficient to cover the following: > > > > I have a table where each user can register several tuples. > For now, > > I'd like to present it as an editable table where the field > User is > > not editable (not even visible) and will be constants for > all tuples > > entered by that user. > > > > Best regards, > > > > Marko > > > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > > > [2 ] > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > [2 ] > ___ > Ur mailing > listUr@impredicative.comhttp://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > ___ > Ur mailing > listUr@impredicative.comhttp://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Ur/Web people organizer: editable table with fixed (hidden) field?
Am I correct in thinking that you basically want something like InputStrings's "const" and "given" parameters, but for EditableTable? On Tue, Apr 11, 2017 at 13:03 Marko Schütz Schmuck < markoschu...@googlemail.com> wrote: > On Tue, 11 Apr 2017 12:18:59 -0400, > Adam Chlipala wrote: > > > > If the "user" field is not editable, how do you choose which user to > associate with a new row? > > I was thinking that it could be a transaction argument to the widget > function like > > ... > val widgets = {User = sinkWidget (getCookie userC), ...} > > alternatively maybe it should be another part of the struct passed to > the EditableTable.Make functor like "permission"? > > Best regards, > > Marko > > > On 04/11/2017 12:10 PM, Marko Schütz Schmuck wrote: > > > > On Tue, 11 Apr 2017 10:58:31 -0400, > > Adam Chlipala wrote: > > > > OK, so you don't want to support adding or deleting rows, just > editing the ones that > > already exist? I'm not sure UPO has something like that right > now, but I'd need to look > > through the code again to be sure. > > > > No, no: adding and deleting are required too. It's just that I want > to > > have the User field not editable. A "sink widget" that does not > > display but can be assigned as the widget of a field might work? The > > field would still be in the records and be stored in the table. > > > > Best regards, > > > > Marko > > > > On 04/10/2017 04:14 PM, Marko Schütz Schmuck wrote: > > > > I was wondering whether the tools available in UPO are > already > > sufficient to cover the following: > > > > I have a table where each user can register several tuples. > For now, > > I'd like to present it as an editable table where the field > User is > > not editable (not even visible) and will be constants for > all tuples > > entered by that user. > > > > Best regards, > > > > Marko > > > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > > > [2 ] > > ___ > > Ur mailing list > > Ur@impredicative.com > > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > ___ > Ur mailing list > Ur@impredicative.com > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Re: [Ur] Ur/Web people organizer: editable table with fixed (hidden) field?
If the "user" field is not editable, how do you choose which user to associate with a new row? On 04/11/2017 12:10 PM, Marko Schütz Schmuck wrote: On Tue, 11 Apr 2017 10:58:31 -0400, Adam Chlipala wrote: OK, so you don't want to support adding or deleting rows, just editing the ones that already exist? I'm not sure UPO has something like that right now, but I'd need to look through the code again to be sure. No, no: adding and deleting are required too. It's just that I want to have the User field not editable. A "sink widget" that does not display but can be assigned as the widget of a field might work? The field would still be in the records and be stored in the table. Best regards, Marko On 04/10/2017 04:14 PM, Marko Schütz Schmuck wrote: I was wondering whether the tools available in UPO are already sufficient to cover the following: I have a table where each user can register several tuples. For now, I'd like to present it as an editable table where the field User is not editable (not even visible) and will be constants for all tuples entered by that user. Best regards, Marko ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur ___ Ur mailing list Ur@impredicative.com http://www.impredicative.com/cgi-bin/mailman/listinfo/ur