Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90678991
Send_APP_Mail.py.wml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 3, 19:57
Size
4 KB
Mime Type
text/x-python
Expires
Tue, Nov 5, 19:57 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22117131
Attached To
R3600 invenio-infoscience
Send_APP_Mail.py.wml
View Options
## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware 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.
##
## The CDSware 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 CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
## Description: function Send_APP_Mail
## This function send an email informing the original
## submitter of a document that the referee has approved/
## rejected the document. The email is also sent to the
## referee for checking.
## Author: T.Baron
## PARAMETERS:
## newrnin: name of the file containing the 2nd reference
## addressesAPP: email addresses to which the email will
## be sent (additionally to the author)
## categformatAPP: variable needed to derive the addresses
## mentioned above
from cdsware.access_control_admin import acc_getRoleUsers,acc_getRoleId
execfile("%s/cdsware/websubmit_functions/mail.py" % pylibdir)
def Send_APP_Mail (parameters,curdir,form):
global emailvalue,titlevalue,authorvalue,sysno,rn
FROMADDR = 'CDS webSubmit <%s>' % supportemail
doctype = form['doctype']
emailvalue = emailvalue.replace("\n","")
titlevalue = titlevalue.replace("\n","")
authorvalue = authorvalue.replace("\n","")
# variables declaration
categformat = parameters['categformatAPP']
otheraddresses = parameters['addressesAPP']
newrnpath = parameters['newrnin']
# retrieve values stored into files
if os.path.exists("%s/COM" % curdir):
fp = open("%s/COM" % curdir, "r")
comment = fp.read()
fp.close()
else:
comment = ""
if os.path.exists("%s/decision" % curdir):
fp = open("%s/decision" % curdir,"r")
decision = fp.read()
fp.close()
else:
decision = ""
if os.path.exists("%s/%s" % (curdir,newrnpath)):
fp = open("%s/%s" % (curdir,newrnpath) , "r")
newrn = fp.read()
fp.close()
else:
newrn = ""
# Document name
res = run_sql("SELECT ldocname FROM sbmDOCTYPE WHERE sdocname='%s'" % doctype)
docname = res[0][0]
# retrieve category
categformat = categformat.replace("<CATEG>","([^-]*)")
categs = re.match(categformat,rn)
if categs != None:
category = categs.group(1)
else:
category = "unknown"
# Build referee's email address
refereeaddress = ""
# Try to retrieve the referee's email from the referee's database
for user in acc_getRoleUsers(acc_getRoleId("referee_%s_%s" % (doctype,category))):
refereeaddress += user[1] + ","
refereeaddress = re.sub(",$","",refereeaddress)
# Creation of the mail for the referee
otheraddresses = otheraddresses.replace("<CATEG>",category)
addresses = ""
if refereeaddress != "":
addresses = refereeaddress + ","
if otheraddresses != "":
addresses += otheraddresses
else:
addresses = re.sub(",$","",addresses)
if decision == "approve":
mailtitle = "%s has been approved" % rn
mailbody = "The %s %s has been approved." % (docname,rn)
else:
mailtitle = "%s has been rejected" % rn
mailbody = "The %s %s has been rejected." % (docname,rn)
if rn != newrn and decision == "approve" and newrn != "":
mailbody += "Its new reference number is: %s" % newrn
mailbody += "\n\nTitle: %s\n\nAuthor(s): %s\n\n" % (titlevalue,authorvalue)
if comment != "":
mailbody += "Comments from the referee:\n%s\n" % comment
mailbody += "---------------------------------------------\nBest regards.\nThe submission team.\n"
#Send mail to referee
# Actually send the email
body = forge_email(FROMADDR,addresses,adminemail,mailtitle,mailbody)
send_email(FROMADDR,addresses,body,0)
return ""
</protect>
Event Timeline
Log In to Comment