示例#1
0
func getdeleteart(wr *web.Context) {

	var alltotal int

	//Get list of articles
	all := jailgo.GetartList()
	if all != nil {
		alltotal = len(all.Arts) - 1
	}
	for i := 0; i <= alltotal; i++ {
		if alltotal < 0 {
			log.Println("DEBUG Admin: Negative Slice passed")
		} else {

			// i IS NOT EQUAL TO THREADID!!!
			if all.Arts != nil {

				//Convert Row to string
				artid := all.Arts[i].Str(all.Id)

				//Convert string to int
				articleid, _ := strconv.Atoi(artid)

				//Print Article through its Id
				if jailgo.Getart(articleid) != nil {
					index_del.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)})
				}
			}
		}
	}
}
示例#2
0
func last(wr *web.Context) {
	var alltotal int

	//Get list of articles
	all := jailgo.GetartList()
	if all != nil {
		alltotal = len(all.Arts) - 1

		//Get three last articles
		for i := alltotal; i >= alltotal-2; i-- {
			if alltotal < 0 {
				log.Println("DEBUG Last: Negative Slice passed")
				return
			} else {

				// i IS NOT EQUAL TO THREADID!!!
				if all.Arts != nil && i >= 0 {

					//Convert Row to string
					artid := all.Arts[i].Str(all.Id)

					//Convert string to int
					articleid, _ := strconv.Atoi(artid)

					//Print Article through its Id
					foot_last.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)})
				}
			}
		}
	}
}
示例#3
0
func showblog(wr *web.Context) {

	var (
		alltotal int
	)

	// Render basic layout html
	index.Exec(wr)

	//Get list of articles
	all := jailgo.GetartList()
	if all != nil {
		alltotal = len(all.Arts) - 1
	}
	for i := alltotal; i >= alltotal-6; i-- {
		if alltotal < 0 {
			log.Println("DEBUG Negative Slice passed")
		} else {

			// i IS NOT EQUAL TO THREADID!!!
			if all.Arts != nil && i >= 0 {

				//Convert Row to string
				artid := all.Arts[i].Str(all.Id)

				//Convert string to int
				articleid, _ := strconv.Atoi(artid)

				//Print Article through its Id
				index_view.Exec(wr, ViewCtxArticle{jailgo.Getart(articleid)})
			}
		}
	}

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

		// Get last published
		last(wr)
		foot2.Exec(wr)
	} else {
		check := ""
		foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()})
		last(wr)
		foot2.Exec(wr)
	}
}
示例#4
0
func getalldeletentry(wr *web.Context) {

	//Get list of articles
	all := jailgo.GetartList()
	if all != nil {
		for i := 0; i <= len(all.Arts)-1; i++ {

			// i IS NOT EQUAL TO THREADID!!!
			if all.Arts != nil {

				//Convert Row to string
				artid := all.Arts[i].Str(all.Id)

				//Convert string to int
				articleid, _ := strconv.Atoi(artid)

				//Get entries for articleid
				getdeletentry(wr, articleid)
			}
		}
	}
}
示例#5
0
func search(wr *web.Context) {

	var (
		alltotal int
	)

	// Render basic layout html
	searching.Exec(wr)
	year := wr.Request.Params["threadyear"]
	month := wr.Request.Params["threaddate"]

	//Get list of articles
	all := jailgo.GetartList()
	if all != nil {
		alltotal = len(all.Arts) - 1
	}
	for i := 0; i <= alltotal; i++ {
		if alltotal < 0 {
			log.Println("DEBUG Negative Slice passed")
		} else {

			// i IS NOT EQUAL TO THREADID!!!
			if all.Arts != nil {

				//Convert Row to string
				artid := all.Arts[i].Str(all.Id)

				//Convert string to int
				articleid, _ := strconv.Atoi(artid)

				// Getting Options
				if month != "select" && year != "select" {
					a := jailgo.Getart(articleid)
					if a.Year == year && a.Month == month {
						results.Exec(wr, ViewCtxArticle{a})
					}
				} else if month != "select" {
					a := jailgo.Getart(articleid)
					if a.Month == month {
						results.Exec(wr, ViewCtxArticle{a})
					}
				} else if year != "select" {
					a := jailgo.Getart(articleid)
					if a.Year == year {
						results.Exec(wr, ViewCtxArticle{a})
					}
				}
			}
		}
	}
	// Get login
	if wr.Request.Params["check"] != "" {
		check := wr.Request.Params["check"]
		foot1.Exec(wr, ViewCtxLogin{BlogLogin(wr, check), vinfo()})

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