コード例 #1
0
ファイル: photos.go プロジェクト: Epictetus/wfdr
func AlbumHandler(c http.ResponseWriter, r *http.Request) {
	var albumName = r.URL.Path[len("/photos/"):]
	fmt.Printf("Album ID requested: %s\n", albumName)
	var photos = GetPhotos(albumName)
	fmt.Printf("%d Photos\n", len(photos))
	tmpl.Render(c, r, "Photos - "+albumName, "album", &photos)
}
コード例 #2
0
ファイル: add-event.go プロジェクト: Epictetus/wfdr
func EditHandler(c http.ResponseWriter, r *http.Request) {
	if r.Method == "POST" {
		SaveHandler(c, r)
		return
	}
	//p := auth.GetPerms(r)
	//var i tmpl.PageInfo
	//i.Name = "events/edit"
	//i.Title = "Add Event"
	//i.Perms = p
	//i.Request = r

	// Makes the current data available to the template if available
	evEdit := len("/events/edit/")
	title := "Add Event"
	event := new(Event)
	if len(r.URL.Path) > evEdit {
		id := r.URL.Path[evEdit:]
		event.ID = id
		e := event.Load()
		if e != nil {
			fmt.Println(e)
		}
		e = event.LoadPage(r)
		if e != nil {
			fmt.Println(e)
		}
		title = "Edit Event - " + event.Title
	}

	tmpl.Render(c, r, title, "edit", event)
}
コード例 #3
0
ファイル: photos.go プロジェクト: Epictetus/wfdr
func UploaderHandler(c http.ResponseWriter, r *http.Request) {
	u, _ := user.Get(c, r)
	token := u.Get("picasa-authsub-token")
	fmt.Println("Host:", r.Host)
	albums := GetAlbums()

	data := new(UploaderData)
	data.Albums = albums
	data.PicasaAuthenticated = (token != "")
	// TODO: Make photos use the new login system.

	tmpl.Render(c, r, "Upload Photos", "uploader", data)
}
コード例 #4
0
ファイル: photos.go プロジェクト: Epictetus/wfdr
func MainHandler(c http.ResponseWriter, r *http.Request) {
	var albums = GetAlbums()
	fmt.Printf("%d Albums\n", len(*albums))
	tmpl.Render(c, r, "Photos", "main", &albums)
}