Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jvimal/boxopa
base: ec0f8b8fd3
...
head fork: jvimal/boxopa
compare: eb4b5b03b5
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Mar 16, 2012
Mathieu Baudet Fixed onclick funs and several server directives 94061be
@jvimal Merge pull request #2 from MathieuBt/master
fix compilation + security on Opa S4 0.9.1
eb4b5b0
Showing with 7 additions and 13 deletions.
  1. +7 −13 box.opa
View
20 box.opa
@@ -24,19 +24,16 @@ type Box = { files: list(File) }
db /box: stringmap(Box)
db /box[_] = { files = [] }
-@server
+@server_private
hostname() = "http://localhost:8080"
-@server
get_file_info(f: File) =
{ name = f.name;
mimetype = f.mimetype;
id = f.id }
-@server
box_url(id) = "{hostname()}/box/{id}"
-@server
index_page() =
(
id = Random.string(8)
@@ -46,20 +43,20 @@ index_page() =
<h1>Welcome</h1>
<a href="/box/{id}"><img src="http://i.imgur.com/WBbSg.png"/></a>
<h3>Your box has been created. Click <a href="/box/{id}">the box</a> to open it!</h3>
- <input type="text" id="perm" value="{box_url(id)}" onclick="this.select();" />
+ <input type="text" id="perm" value="{box_url(id)}" onclick={_ -> Dom.select(#perm)} />
</div>
</body>
)
)
-@server
+@server_private
create_file(bid, f) =
(
do /box[bid]/files <- List.add(f, /box[bid]/files);
void
)
-@server
+@server_private
delete_file(bid, id) =
(
files = /box[bid]/files
@@ -69,12 +66,10 @@ delete_file(bid, id) =
Network.broadcast(info, room)
)
-@server
get_image(m) =
if String.has_prefix("image", m) then "http://i.imgur.com/wCvgr.png"
else "http://i.imgur.com/qDkLr.png"
-@server
show_file(box, f) =
(
<div class="span3" id="{f.id}" style="padding-top: 50px;">
@@ -84,7 +79,7 @@ show_file(box, f) =
</div>
)
-@server
+@server_private
process_upload(bid,upload_data) =
(
up_file = StringMap.get("upload", upload_data.uploaded_files)
@@ -140,7 +135,7 @@ files_update(boxid, f: FileInfo) =
Dom.remove(#{f.id})
-@server
+@server_private
show_box(path) =
(
b = /box[path]
@@ -154,7 +149,7 @@ show_box(path) =
<h3>Click the file icon to download the file.</h3>
<h3>Anyone with this box's URL will be able to download these files!</h3>
<h3>Copy the URL and share with friends!</h3>
- <input type="text" id="perm" value="{box_url(path)}" onclick="this.select();" />
+ <input type="text" id="perm" value="{box_url(path)}" onclick={_ -> Dom.select(#perm)} />
<p>All viewers of this page will see the files the instant they are uploaded.</p>
<div class="row" id="files">
{List.map(show_file(path,_), finfo)}
@@ -186,7 +181,6 @@ deliver_assets(lst) =
)
| _ -> do_404()
-@server
start(uri) = (
match uri with
| {path = {nil} ...} -> index_page()

No commit comments for this range

Something went wrong with that request. Please try again.