diff --git a/.gitignore b/.gitignore
index 02bd5f1319..02371ca348 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,4 @@ dbmigrator
inveniomigrate
recomp.sh
*.swp
-.DS_Store
+.DS_Storei
diff --git a/invenio/templates/record.html b/invenio/templates/record.html
index be9cb880b7..a0e9713148 100644
--- a/invenio/templates/record.html
+++ b/invenio/templates/record.html
@@ -77,16 +77,17 @@
-
{% endif%}
{% if has_private_files %}
- This record contains private files, which are not listed here.
+ This record contains private files, which are not listed here.
+
Request Data
{% endif%}
{% block record_tabs %}
{%- for tab in tabs|sort(attribute='order') -%}
diff --git a/simplestore/etc/templates/request_data.html b/simplestore/etc/templates/request_data.html
new file mode 100644
index 0000000000..fdf5ee03ad
--- /dev/null
+++ b/simplestore/etc/templates/request_data.html
@@ -0,0 +1,289 @@
+{% extends "page.html" %}
+{% block header %}
+ {{ super() }}
+ {% css 'css/simplestore-style.css', '50-simplestore' %}
+ {% css 'css/font-awesome.min.css', '50-simplestore' %}
+ {% css 'css/bootstrap-switch.css', '50-simplestore' %}
+ {% css 'css/jquery-ui.css', '50-simplestore' %}
+ {% css 'css/view.css','50-simplestore' %}
+
+ {% js 'js/bootstrap-switch.js', '50-simplestore' %}
+ {% js 'js/jquery-ui-1.10.3.custom.min.js', '50-simplestore' %}
+ {% js 'js/view.js','50-simplestore' %}
+{% endblock %}
+{% block body %}
+
+{% endblock body %}
diff --git a/simplestore/lib/request_data_blueprint.py b/simplestore/lib/request_data_blueprint.py
new file mode 100644
index 0000000000..5e588ff6d3
--- /dev/null
+++ b/simplestore/lib/request_data_blueprint.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+## This file is part of SimpleStore.
+## Copyright (C) 2013 EPCC, The University of Edinburgh.
+##
+## SimpleStore is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2 of the
+## License, or (at your option) any later version.
+##
+## SimpleStore is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with SimpleStore; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+
+from flask import request
+from invenio.webinterface_handler_flask_utils import _, InvenioBlueprint
+import invenio.request_data_form as reqdata
+
+blueprint = InvenioBlueprint('request_data_form', __name__,
+ url_prefix='/reqdata'
+ )
+
+@blueprint.route('/', methods=['GET'])
+def request_data_form_noparams():
+ return reqdata.request_data_form(request,-1)
+
+@blueprint.route('/',methods=['GET'])
+def request_data_form(recid):
+ return reqdata.request_data_form(request,recid)
+
+@blueprint.route('/submit',methods=['POST'])
+def request_data_submit():
+ return reqdata.request_data_submit(request)
diff --git a/simplestore/lib/request_data_form.py b/simplestore/lib/request_data_form.py
new file mode 100644
index 0000000000..8256c8c8c6
--- /dev/null
+++ b/simplestore/lib/request_data_form.py
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+
+## This file is part of SimpleStore.
+## Copyright (C) 2013 EPCC, The University of Edinburgh.
+##
+## SimpleStore is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2 of the
+## License, or (at your option) any later version.
+##
+## SimpleStore is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with SimpleStore; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+from flask import render_template, request, redirect, url_for, jsonify
+
+from invenio.config import CFG_SITE_SECRET_KEY
+from invenio.bibtask import task_low_level_submission
+from invenio.config import CFG_TMPSHAREDDIR
+from invenio.wtforms_utils import InvenioBaseForm
+from invenio.webuser_flask import current_user
+from invenio.htmlutils import remove_html_markup
+from invenio.mailutils import send_email
+from invenio.config import CFG_SITE_SUPPORT_EMAIL
+from recaptcha.client import captcha
+from invenio.config import CFG_CAPTCHA_PRIVATE_KEY
+from validate_email import validate_email
+from invenio.config import CFG_SITE_URL
+import re
+
+def check_phone(num):
+ if not re.match("^[0-9-+]+",num):
+ return False
+ return True
+
+def request_data_form(request,recid):
+ if(recid == -1):
+ link_txt = ""
+ else:
+ link_txt = CFG_SITE_URL + "/record/" + recid
+ return render_template('request_data.html',full_link=link_txt)
+
+def request_data_submit(request):
+ link = request.form.get('element_9_1','')
+ #subject = request.form.get('element_1','')
+ reason = request.form.get('element_7','')
+ first_name = request.form.get('element_3_1','')
+ last_name = request.form.get('element_3_2','')
+ affiliation = request.form.get('element_5','')
+ email = request.form.get('element_6','')
+ phone = request.form.get('element_4','')
+ country = request.form.get('element_2_6','')
+ recaptcha_challenge = request.form.get('recaptcha_challenge_field','')
+ recaptcha_response = request.form.get('recaptcha_response_field','')
+ subject_text = "Request Data"
+
+ if(link == '' or len(link)>256):
+ return render_template('request_data.html',warning_msg="Link is missing")
+
+ if(reason == ''):
+ return render_template('request_data.html',warning_msg="Message body is missing")
+
+ if(first_name == '' or len(first_name) > 256):
+ return render_template('request_data.html',warning_msg="First Name is missing")
+
+ if(last_name == '' or len(last_name) > 256):
+ return render_template('request_data.html',warning_msg="Last Name is missing")
+
+ if(affiliation == '' or len(affiliation) > 256):
+ return render_template('request_data.html',warning_msg="Affiliation is missing")
+
+ if(email == '' or validate_email(email,verify=True) == False):
+ return render_template('request_data.html',warning_msg="Email address missing or format is invalid")
+
+ if(country == ''or len(country) > 256):
+ return render_template('request_data.html',warning_msg="Country is missing")
+
+ if(phone == '' or check_phone(phone) == False or len(phone) > 30):
+ return render_template('request_data.html',warning_msg="Phone is missing or invalid format")
+
+ if(recaptcha_challenge == ''):
+ return render_template('request_data.html',warning_msg="Recaptcha Challenge is missing")
+
+ if(recaptcha_response == ''):
+ return render_template('request_data.html',warning_msg="Recaptcha Response is missing")
+
+ submit_response = captcha.submit(
+ recaptcha_challenge,
+ recaptcha_response,
+ CFG_CAPTCHA_PRIVATE_KEY,
+ request.remote_addr
+ )
+
+ if not submit_response.is_valid:
+ return render_template('request_data.html',warning_msg="Incorrect Captcha response")
+
+ else:
+ msg_content = """
+You have a request for your data!
+
+Link: """ + link + """
+Subject: """ + subject_text + """
+Reason: """ + reason + """
+First Name: """ + first_name + """
+Last Name: """ + last_name + """
+Affiliation: """ + affiliation + """
+Email: """ + email + """
+Country: """ + country + """
+Phone: """ + phone + """
+
+"""
+
+ send_email(email,CFG_SITE_SUPPORT_EMAIL,
+ subject='Request Data',content=msg_content)
+
+ return render_template('request_data.html',warning_msg="Request Data submitted!")