Anand Doshi | 486f9df | 2012-07-19 13:40:31 +0530 | [diff] [blame] | 1 | from __future__ import unicode_literals |
Rushabh Mehta | c01b7e9 | 2012-03-21 12:29:56 +0530 | [diff] [blame] | 2 | install_docs = [ |
Anand Doshi | 24e1856 | 2012-04-17 11:45:35 +0530 | [diff] [blame] | 3 | {"doctype":"Role", "role_name":"Blogger", "name":"Blogger"}, |
| 4 | {"doctype":"Role", "role_name":"Website Manager", "name":"Website Manager"}, |
| 5 | ] |
Rushabh Mehta | 389880d | 2012-04-27 18:39:14 +0530 | [diff] [blame] | 6 | |
| 7 | import webnotes |
| 8 | |
| 9 | @webnotes.whitelist(allow_guest=True) |
| 10 | def send_message(): |
| 11 | from webnotes.model.doc import Document |
| 12 | args = webnotes.form_dict |
| 13 | |
| 14 | d = Document('Support Ticket') |
| 15 | d.subject = webnotes.form_dict.get('subject', 'Website Query') |
| 16 | d.description = webnotes.form_dict.get('message') |
| 17 | d.raised_by = webnotes.form_dict.get('sender') |
| 18 | |
| 19 | if not d.description: |
| 20 | webnotes.msgprint('Please write something', raise_exception=True) |
| 21 | |
| 22 | if not d.raised_by: |
| 23 | webnotes.msgprint('Please give us your email id so that we can write back to you', raise_exception=True) |
| 24 | |
| 25 | d.save() |
Anand Doshi | 7aedaec | 2012-10-16 10:47:18 +0530 | [diff] [blame] | 26 | webnotes.msgprint('Thank you!') |
| 27 | |
| 28 | def get_site_address(): |
| 29 | from webnotes.utils import get_request_site_address |
| 30 | url = get_request_site_address() |
| 31 | |
| 32 | if not url or url=='http://localhost': |
| 33 | new_url = webnotes.conn.get_value('Website Settings', 'Website Settings', |
| 34 | 'subdomain') |
| 35 | if new_url: |
| 36 | url = "http://" + new_url |
| 37 | |
| 38 | return url |