2017-01-25 18:36:41 +00:00
|
|
|
/*
|
|
|
|
Copyright 2017 The Camlistore Authors.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// The goui program inserts the javascript code generated by gopherjs for the
|
|
|
|
// web UI into the existing web UI javascript codebase.
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"camlistore.org/server/camlistored/ui/goui/aboutdialog"
|
pkg/server: add files "zipper" to DownloadHandler
We want to add a feature for clients (the web UI), where they can select
a bunch of files and ask the server for a zip archive of all these files.
This CL modifies the DownloadHandler so it does exactly that upon
reception of a POST request with a query parameter of the form
files=sha1-foo,sha1-bar,sha1-baz
This CL also adds a new button to the contextual sidebar of the web UI,
that takes care of sending the download request to the server.
known limitations: only permanodes with file as camliContent are
accepted as a valid selection (i.e. no sets, or static-dirs, etc) for
now.
Implementation detail:
We're creating an ephemeral DOM form on the fly to send the request.
The reason is: if we sent it as a Go http request, we'd have to read
the response manually and then we'd have no way of writing it to disk.
If we did it with an xhr, we could write the response to disk by
creating a File or Blob and then using URL.createObjectURL(), but we'd
have to keep the response in memory while doing so, which is
unacceptable for large enough archives.
Fixes #899
Change-Id: I104f7c5bd10ab3369e28d33752380dd12b5b3e6b
2017-03-06 20:02:19 +00:00
|
|
|
"camlistore.org/server/camlistored/ui/goui/downloadbutton"
|
2017-06-13 00:03:10 +00:00
|
|
|
"camlistore.org/server/camlistored/ui/goui/geo"
|
2017-03-17 23:16:30 +00:00
|
|
|
"camlistore.org/server/camlistored/ui/goui/sharebutton"
|
2017-01-25 18:36:41 +00:00
|
|
|
|
|
|
|
"github.com/gopherjs/gopherjs/js"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
js.Global.Set("goreact", map[string]interface{}{
|
2017-06-13 00:03:10 +00:00
|
|
|
"AboutMenuItem": aboutdialog.New,
|
|
|
|
"DownloadItemsBtn": downloadbutton.New,
|
|
|
|
"ShareItemsBtn": sharebutton.New,
|
|
|
|
"Geocode": geo.Lookup,
|
|
|
|
"IsLocPredicate": geo.IsLocPredicate,
|
|
|
|
"LocPredicatePrefix": geo.LocPredicatePrefix,
|
|
|
|
"LocationCenter": geo.LocationCenter,
|
server/camlistored/ui: improve map aspect search and markers
Notably:
-do not load any markers on an empty search query, because that would
mean loading absolutely all of the items with a location, which seems
like a bad idea.
-use different markers for different nodes. For now, foursquare
checkins, file images, and files have their own marker.
-vendor in https://github.com/lvoogdt/Leaflet.awesome-markers to achieve
the above, which relies on Font Awesome, which we already have in.
icons available for the markers: http://fontawesome.io/icons/
-when no location can be inferred from the search query, set the view to
encompass all markers that were drawn.
-when a location search is known, draw a rectangle representing the
results zone.
-use thumber for image in marker popup
-use title, if possible, instead of blobRef for link text in marker
popup
-switch to directly using OpenStreetMap tiles, instead of MapBox ones.
https://storage.googleapis.com/camlistore-screenshots/Screenshot_20170622-232359.png
Change-Id: Ibc84fa988aea8b8d3a2588ee8790adf6d9b5ad7a
2017-06-21 16:36:15 +00:00
|
|
|
"WrapAntimeridian": geo.WrapAntimeridian,
|
2017-01-25 18:36:41 +00:00
|
|
|
})
|
|
|
|
}
|