func UpdateSubject(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
	redirected, _ := ensureLoggedIn(w, r)
	if redirected {
		return
	}

	short := html.EscapeString(params.ByName("short"))
	subject := model.Subject{Short: short}
	if !subject.Exists() {
		http.NotFound(w, r)
		return
	}

	// Parse and validate subject data.
	nshort, name, splitClass := parseSubjectData(r)
	valid, message := validateSubjectData(short, name, splitClass)
	if !valid {
		http.Error(w, message, http.StatusNotAcceptable)
		return
	}

	// Update subject and send the new URL back to the client.
	// It might have changed with an update of short.
	updSubject := model.Subject{Short: nshort, Name: name, SplitClass: splitClass}
	updSubject.UpdateShort(short)
	w.Write([]byte(fmt.Sprintf("/subject/%s", nshort)))
}
// UpdateSubject updates a subject with the uploaded information.
UpdateSubject updates a subject with the uploaded information.
// UpdateSubject updates a subject with the uploaded information .
func UpdateSubject(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
	redirected, _ := ensureLoggedIn(w, r)
	if redirected {
		return
	}
	short := html.EscapeString(params.ByName("short"))
	subject := model.Subject{Short: short}
	if !subject.Exists() {
		http.NotFound(w, r)
		return
	}
	nshort, name, splitClass := parseSubjectData(r)
	valid, message := validateSubjectData(short, name, splitClass)
	if !valid {
		http.Error(w, message, http.StatusNotAcceptable)
		return
	}
	updSubject := model.Subject{Short: nshort, Name: name, SplitClass: splitClass}
	updSubject.UpdateShort(short)
	w.Write([]byte(fmt.Sprintf("/subject/%s", nshort)))
}
func UpdateSubject ( w http . ResponseWriter , r * http . Request , params httprouter . Params ) { redirected , _ := ensureLoggedIn ( w , r ) if redirected { return } short := html . EscapeString ( params . ByName ( " " ) ) subject := model . Subject { Short : short } if ! subject . Exists ( ) { http . NotFound ( w , r ) return } nshort , name , splitClass := parseSubjectData ( r ) valid , message := validateSubjectData ( short , name , splitClass ) if ! valid { http . Error ( w , message , http . StatusNotAcceptable ) return } updSubject := model . Subject { Short : nshort , Name : name , SplitClass : splitClass } updSubject . UpdateShort ( short ) w . Write ( [ ] byte ( fmt . Sprintf ( " " , nshort ) ) ) }
UpdateSubject updates a subject with the uploaded information.
UpdateSubject updates a subject with the uploaded information .
// Parse and validate subject data. // Update subject and send the new URL back to the client. // It might have changed with an update of short.