parent
e42e9e2bb2
commit
fd55417ee6
|
@ -723,7 +723,7 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
('announces', 'announces_dir'),
|
||||
'accessibility', 'contact', 'help',
|
||||
'myspace', 'services', 'agenda',
|
||||
'themes', 'pages', 'payment', 'invoices', 'trackingcode']
|
||||
'themes', 'pages', 'payment', 'invoices', 'accesscode']
|
||||
|
||||
admin = admin.AdminRootDirectory()
|
||||
announces_dir = AnnouncesDirectory()
|
||||
|
@ -989,6 +989,13 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
'<div id="sidebox">'
|
||||
root_url = get_publisher().get_root_url()
|
||||
|
||||
if self.has_anonymous_access_codes():
|
||||
'<form id="follow-form" action="%saccesscode">' % root_url
|
||||
'<h3>%s</h3>' % _('Tracking')
|
||||
'<label>%s</label> ' % _('Code:')
|
||||
'<input name="code" size="10"/>'
|
||||
'</form>'
|
||||
|
||||
self.links()
|
||||
|
||||
cats = Category.select(order_by = 'name')
|
||||
|
@ -1022,6 +1029,35 @@ class AlternateRootDirectory(OldRootDirectory):
|
|||
|
||||
'</div>'
|
||||
|
||||
def has_anonymous_access_codes(self):
|
||||
for workflow in Workflow.select():
|
||||
for wfstatus in workflow.possible_status:
|
||||
for wfitem in wfstatus.items:
|
||||
if wfitem.key == 'create-anonymous-access-code':
|
||||
return True
|
||||
return False
|
||||
|
||||
def accesscode(self):
|
||||
code = get_request().form.get('code')
|
||||
if not code:
|
||||
return redirect(get_publisher().get_root_url())
|
||||
try:
|
||||
token = Token.get(code)
|
||||
except KeyError:
|
||||
return redirect(get_publisher().get_root_url())
|
||||
if token.type != 'anonymous-access-code':
|
||||
return redirect(get_publisher().get_root_url())
|
||||
formdef_urlname, formdata_id = token.formdata_reference
|
||||
try:
|
||||
formdata = FormDef.get_by_urlname(formdef_urlname).data_class().get(formdata_id)
|
||||
except KeyError:
|
||||
return redirect(get_publisher().get_root_url())
|
||||
session = get_session()
|
||||
if not hasattr(session, '_wf_anonymous_access_authorized'):
|
||||
session._wf_anonymous_access_authorized = []
|
||||
session._wf_anonymous_access_authorized.append(formdata.get_url())
|
||||
return redirect(formdata.get_url() + 'access/')
|
||||
|
||||
def links [html] (self):
|
||||
links = Link.select()
|
||||
if not links:
|
||||
|
@ -1127,7 +1163,7 @@ get_publisher_class().use_sms_feature = True
|
|||
|
||||
# help links
|
||||
get_publisher_class().backoffice_help_url = {
|
||||
'fr': 'http://doc.entrouvert.org/au-quotidien/stable/guide-gestionnaire.html'
|
||||
'fr': 'http://auquotidien.labs.libre-entreprise.org/doc/fr/manager-guide.html',
|
||||
}
|
||||
get_publisher_class().admin_help_url = {
|
||||
'fr': 'http://auquotidien.labs.libre-entreprise.org/doc/fr/user-guide.html',
|
||||
|
|
Reference in New Issue