Skip to content
Browse files

[feature] opages: try fix bug save

  • Loading branch information...
1 parent 237fca0 commit 8115347e8bab68645e66e69e1bec1483807fe73a @Aqua-Ye Aqua-Ye committed Jul 8, 2011
Showing with 13 additions and 10 deletions.
  1. +13 −10 OPAges/src/page.opa
View
23 OPAges/src/page.opa
@@ -774,16 +774,17 @@ Page = {{
@TODO: should be cached maybe? */
make_map(i, (author, date, parent), acc) =
- i = i+1
+ i = i
+ do jlog("map {i} - {parent}")
acc = IntMap.add(i, (author, date, parent, []), acc)
match IntMap.get(parent, acc)
{some=(author, date, par, sons)} -> IntMap.add(parent, (author, date, par, [i|sons]), acc)
- _ -> acc
+ _ -> IntMap.add(parent, (author, date, -1, [i]), acc)
map = List.foldi(make_map, hist, IntMap.empty)
/* Build one revision of the file for the select input */
build_rev(key, (author, date, parent, sons), (acc, pad)) =
- i = key
+ i = key+1
based = "" // if parent < 0 then "" else " based on {parent}"
pad = String.make(pad, '-')
value = "{pad}#{i} | {Date.to_formatted_string(Date.date_only_printer, date)} @ {Date.to_formatted_string(Date.time_only_printer, date)} by {author}{based}"
@@ -802,7 +803,8 @@ Page = {{
rec aux(map, rev, (acc, pad, p_sons_len)) =
match IntMap.get(rev, map)
{some=(author, date, parent, sons)} ->
- acc = build_rev(rev, (author, date, parent, sons), (acc, pad))
+ do jlog("rev {rev}")
+ acc = if rev < 0 then acc else build_rev(rev, (author, date, parent, sons), (acc, pad))
pad = if p_sons_len > 1 then pad+1 else pad
len = List.length(sons)
List.fold(
@@ -813,7 +815,7 @@ Page = {{
/* Build the file revisions list,
we know the root is revision 1 because no revision is deleted */
build_revisions(map) =
- aux(map, 1, ([], 0, 0))
+ aux(map, -1, ([], 0, 0))
<select id={select_id} onchange={action_change_rev}>
{build_revisions(map)}
@@ -962,10 +964,11 @@ Page = {{
| {binary ~mime ~save ~set_preview} ->
mime_id = "mime_{id}"
save() =
- _rev = save({mime = Dom.get_value(Dom.select_id(mime_id))})
+ rev = save({mime = Dom.get_value(Dom.select_id(mime_id))})
do access.notify.send({save = file})
do Dom.set_enabled(#{save_button_id},true)
- do do_report(<>Save success</>)
+ do do_report(<>Save success -> rev {rev}</>)
+ do build_buffers(some(rev))
void
x = <>
Uneditable binary file, Mimetype
@@ -995,7 +998,7 @@ Page = {{
rev = access.access.save(file, {source=Ace.get_content(ace) mime=get_mime()},rev)
do access.notify.send({save = file})
do build_buffers(some(rev))
- do do_report(<>Save success</>)
+ do do_report(<>Save success -> rev {rev}</>)
Dom.set_enabled(#{save_button_id},false)
read_only(b) = Ace.read_only(ace, b)
@@ -1035,7 +1038,7 @@ Page = {{
rev = access.access.save(file, {css=Ace.get_content(ace)}, rev)
do access.notify.send({save = file})
do build_buffers(some(rev))
- do do_report(<>Save success</>)
+ do do_report(<>Save success -> rev {rev}</>)
Dom.set_enabled(#{save_button_id},false)
read_only(b) = Ace.read_only(ace, b)
preview(f) =
@@ -1085,7 +1088,7 @@ Page = {{
| {~rev} ->
do access.notify.send({save = file})
do build_buffers(some(rev))
- do do_report(<>Save success</>)
+ do do_report(<>Save success -> rev {rev}</>)
Dom.set_enabled(#{save_button_id},false)
| {~fail} ->
do Dom.set_enabled(#{save_button_id},true)

0 comments on commit 8115347

Please sign in to comment.
Something went wrong with that request. Please try again.