Esempio n. 1
0
func getdeletentry(wr *web.Context, articleid int) {

	// Render all comments for article
	eid := jailgo.GetEntryList(articleid)
	if eid != nil {

		// Looping through all entries in List (not too expensive)
		for n := range eid.Entrys {

			// n IS NOT EQUAL TO ENTRYID!!!
			//Convert Row to string
			entid := eid.Entrys[n].Str(eid.Id)

			//Convert string to int
			entryid, _ := strconv.Atoi(entid)

			// Skip empty rows
			if jailgo.GetEntry(entryid, articleid) != nil {
				log.Println("DEBUG Admin: n, articleid ", entryid, articleid)
				comment_del.Exec(wr, ViewCtxComment{jailgo.GetEntry(entryid, articleid)})
			}
		}
	}
}
Esempio n. 2
0
func entry(wr *web.Context, art_num string) {

	var eidtotal int

	// Render basic layout html with article and captcha
	art_num = wr.Params["threadid"]
	id, _ := strconv.Atoi(art_num)

	// Check if you're coming from wrong typed captcha
	if wr.Params["fail"] != "" {
		commentfail.Exec(wr, ViewCtxArticle{jailgo.Getart(id)})
	} else {
		comment.Exec(wr, ViewCtxArticle{jailgo.Getart(id)})
	}

	// Render all comments for article
	eid := jailgo.GetEntryList(id)
	if eid != nil {
		eidtotal = len(eid.Entrys)
	}

	// Looping through all entries in List (not too expensive)
	if eidtotal != 0 {
		for i := range eid.Entrys {
			if eidtotal < 0 {
				log.Println("DEBUG Negative Slice passed")
			} else {

				// i IS NOT EQUAL TO ENTRYID!!!
				//Convert Row to string
				entid := eid.Entrys[i].Str(eid.Id)

				//Convert string to int
				entryid, _ := strconv.Atoi(entid)

				// Skip empty rows
				if jailgo.GetEntry(entryid, id) != nil {
					comment_view.Exec(wr, ViewCtxComment{jailgo.GetEntry(entryid, id)})
				}
			}
		}
	}

	// Render Add comment box and captcha
	comment2.Exec(wr, ViewCtxArtCom{jailgo.Getart(id), showForm(wr)})

	// Get login
	if wr.Params["check"] != "" {
		check := wr.Params["check"]
		foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()})

		// Get last published and search content to javascript
		last(wr)
		foot2.Exec(wr)
	} else {
		check := ""
		foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()})
		last(wr)
		foot2.Exec(wr)
	}
}