Esempio n. 1
0
def contact():
    form = ContactForm()
    if form.validate_on_submit():
        send_message(request.form)
        return redirect('/success')

    return render_template('./contact.html', form=form)
Esempio n. 2
0
def index():
    form = ContactForm()
    if form.validate_on_submit():
        print('-------------------------')
        print(request.form['name'])
        print(request.form['email'])
        print(request.form['subject'])
        print(request.form['message'])
        print('-------------------------')
        send_message(request.form)
        return redirect('/')
    return render_template('index.html', form=form)
Esempio n. 3
0
def gallery():
	
	title='Mlin Umetnin-gallery'

	form = ContactForm()





	desc_gallery=description()


	# print(desc_gallery)




	######## gallery pics selection ######
	List_photo,Cov_photo,List_photo_names=gallery_pic_finder()
	#List_photo=gallery_pic_finder()
	
	# print('#######################################')
	# print(Cov_photo)
	# print('#######################################')
	# print(List_photo)
	# print('#######################################')



	return render_template('main/gallery.html', title=title, form=form, List_photo=List_photo, Cov_photo=Cov_photo,desc_gallery=desc_gallery, List_photo_names=List_photo_names)
Esempio n. 4
0
def contact():
    form = ContactForm()
    if form.validate_on_submit():        
        print('-------------------------')
        print(request.form['message'])
        print('-------------------------')
        #send_message(request.form)
        # with open("C:/Users/aypax/PycharmProjects/contact-form-python-flask/result.json", "w") as json_file:
        #     JS.dump(request.form['message'], json_file)
        # data = JS.load(json_file)
        data = JS.loads(request.form['message'])
        root = ET.Element("TEI")
        root.set("xmlns", "http://www.tei-c.org/ns/1.0")
        teiheader = ET.SubElement(root, "teiHeader")
        filedesc = ET.SubElement(teiheader, "fileDesc")
        titlestmt = ET.SubElement(filedesc, "titleStmt")
        ET.SubElement(titlestmt, "title").text = data['TEI']['teiHeader']['fileDesc']['titleStmt']['title']
        pubstmt = ET.SubElement(filedesc, "publicationStmt")
        ET.SubElement(pubstmt, "p").text = data["TEI"]["teiHeader"]["fileDesc"]["publicationStmt"]["p"]
        source = ET.SubElement(filedesc, "sourceDesc")
        ET.SubElement(source, "p").text = data["TEI"]["teiHeader"]["fileDesc"]["sourceDesc"]["p"]

        text = ET.SubElement(root, "text")
        front = ET.SubElement(text, "front")
        div = ET.SubElement(front, "div")
        div.set("type", "sommaire")
        ET.SubElement(div, "head").text = data["TEI"]["text"]["front"]["div"]["head"]
        table = ET.SubElement(div, "table")
        ET.SubElement(table, "head").text = data["TEI"]["text"]["front"]["div"]["table"]["head"]
        row = ET.SubElement(table, "row")
        for i in range(0, int(request.form['nombre'])):
            j = 0
            ET.SubElement(row, "cell").text = data["TEI"]["text"]["front"]["div"]["table"]["row"][i]["cell"][j]
            ET.SubElement(row, "cell").text = data["TEI"]["text"]["front"]["div"]["table"]["row"][i]["cell"][j+1]
        body = ET.SubElement(text, "body")
        ET.SubElement(body, "p").text = data["TEI"]["text"]["body"]["p"]

        xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent="   ")
        with open("C:/Users/aypax/PycharmProjects/contact-form-python-flask/"+name, "w") as f:
             f.write(xmlstr)
       # downloadFile(name)
        return render_template('views/success/success.html', name=name)

    return render_template('views/accueil/accueil.html', form=form)
Esempio n. 5
0
def index():
	
	title='Mlin Umetnin'

	######## portfolio pics selection ######
	path= "./static/images/home/portfolio"
	List_photo=[]
	path_list= "./static/images/gallery/"
	List_photo_names=[]
	desc_home_raw=[]
	desc_home=[]

	desc_path="./static/images/descriptions/home_pics_description.txt"


	file= open(desc_path,"r", encoding="utf-8")






##dont know yet if this is relevant to sort, if everything goes one after another
	for i in file:
		desc_home_raw.append(i)

	desc_home_raw.sort()

	for i in desc_home_raw:
		row=[]

		row.append(i.split(",")[1])
		row.append(i.split(",")[2])
		desc_home.append(row)
	# print(desc_home)



	for name in os.listdir(path_list):
		

		if os.path.isdir(os.path.join(path_list, name)):

			List_photo_names.append(name)
		else:
			pass

	List_photo_names.sort()






	for image in os.listdir(path):

		List_photo.append("/images/home/portfolio/"+image)


	List_photo.sort()
	
	# print('#######################################')
	# print(List_photo)
	# print('#######################################')



	######## contact form ############
	form = ContactForm()

	formdata = session.get('formdata', None)
	# print('#######################################')
	# print('#######################################')

	# print(session.get('csrf_token'))



	if formdata:
		form = ContactForm(MultiDict(formdata))
		form.validate()
		session.pop('formdata')

	if form.validate_on_submit() == True:
		print('-------------------------')
		print(request.form['name'])
		print(request.form['email'])
		print(request.form['message'])
		print('-------------------------')
		send_message(request.form)

		# return redirect(url_for('index', success=True))
		return redirect('/success')

	if form.is_submitted() and not form.validate():
		print('-------------------------')
		print('validate wrong')
		print('-------------------------')
		session['formdata'] = request.form
		return redirect('#contact')




	return render_template('main/home.html', title=title, form=form,List_photo=List_photo,desc_home=desc_home, List_photo_names=List_photo_names)
Esempio n. 6
0
def single_photo(image_no, collection):
	title='Atelje Mlin Umetnin'
	form = ContactForm()



	desc_gallery= description()


	path_img= "/images/gallery/"+collection+"/"+image_no+".jpg"

		


	List_photo,Cov_photo,List_photo_names=gallery_pic_finder()
	# print(List_photo_names)
	# print(collection)


	colection_index = List_photo_names.index(collection)
	pic_index= List_photo[colection_index].index(path_img)

	no_colections=len(List_photo_names)
	no_pic=len(List_photo[colection_index])
	print('§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§')
	# print(no_colections)
	# print(no_pic)
	# print(colection_index)
	# print(pic_index)
	# print('§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§')
	# print(desc_gallery)
	# print('§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§')
	# print(desc_gallery[colection_index][pic_index][3])
	# print('§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§§')


	exit_path="/gallery/#"+collection

	if pic_index==0:
		# print('blah 210')
		pic_pre= List_photo[colection_index-1][len(List_photo[colection_index-1])-1]
	else:
		pic_pre= List_photo[colection_index][pic_index-1]



	try:

		pic_after= List_photo[colection_index][pic_index+1]
	except:
		if (colection_index+1)==no_colections:
			pic_after= List_photo[0][0]
			# print('blah 216')

		else:
			# print('blah 219')

			pic_after= List_photo[colection_index+1][0]










	return render_template('main/gallery_view.html', title=title, form=form, path_img=path_img, pic_pre=pic_pre,pic_after=pic_after,desc_gallery=desc_gallery, pic_index=pic_index, colection_index=colection_index, exit_path=exit_path)
Esempio n. 7
0
def about():
	title='Mlin Umetnin-about'
	form = ContactForm()


	return render_template('main/about.html', title=title, form=form)