Merge branch 'master' of github.com:webnotes/wnframework

This commit is contained in:
Nabin Hait 2011-12-14 13:22:25 +05:30
commit bdae2894bb
6 changed files with 23 additions and 8 deletions

View file

@ -355,7 +355,8 @@ var doc=locals[cur_frm.doctype][cur_frm.docname];if(args.fmtname=='Standard'){ar
{{HEAD}}\
</div>\
{{DESCRIPTION}}\
</div>"},show_draft:function(args){if(args.doc&&cint(args.doc.docstatus)==0&&cur_frm.perm[0][SUBMIT]){draft=_p.head_banner_format();draft=draft.replace("{{HEAD}}","DRAFT");draft=draft.replace("{{DESCRIPTION}}","This box will go away after the document is submitted.");return draft;}else{return"";}},show_archived:function(args){if(args.doc&&args.doc.__archived){archived=_p.head_banner_format();archived=archived.replace("{{HEAD}}","ARCHIVED");archived=archived.replace("{{DESCRIPTION}}","You must restore this document to make it editable.");}else{return"";}},consolidate_css:function(container,args){var body_style='';var style_list=container.getElementsByTagName('style');while(style_list&&style_list.length>0){for(i in style_list){if(style_list[i]&&style_list[i].innerHTML){body_style+=style_list[i].innerHTML;var parent=style_list[i].parentNode;if(parent){parent.removeChild(style_list[i]);}else{container.removeChild(style_list[i]);}}}
</div>"},show_draft:function(args){var is_doctype_submittable=0;var plist=locals['DocPerm'];for(var perm in plist){var p=plist[perm];if((p.parent==args.doc.doctype)&&(p.submit==1)){is_doctype_submittable=1;break;}}
if(args.doc&&cint(args.doc.docstatus)==0&&is_doctype_submittable){draft=_p.head_banner_format();draft=draft.replace("{{HEAD}}","DRAFT");draft=draft.replace("{{DESCRIPTION}}","This box will go away after the document is submitted.");return draft;}else{return"";}},show_archived:function(args){if(args.doc&&args.doc.__archived){archived=_p.head_banner_format();archived=archived.replace("{{HEAD}}","ARCHIVED");archived=archived.replace("{{DESCRIPTION}}","You must restore this document to make it editable.");}else{return"";}},consolidate_css:function(container,args){var body_style='';var style_list=container.getElementsByTagName('style');while(style_list&&style_list.length>0){for(i in style_list){if(style_list[i]&&style_list[i].innerHTML){body_style+=style_list[i].innerHTML;var parent=style_list[i].parentNode;if(parent){parent.removeChild(style_list[i]);}else{container.removeChild(style_list[i]);}}}
style_list=container.getElementsByTagName('style');}
style_concat=(args.only_body?'':_p.def_print_style_body)
+_p.def_print_style_other+args.style+body_style;return style_concat;},run_embedded_js:function(container,doc){var jslist=container.getElementsByTagName('script');while(jslist&&jslist.length>0){for(i in jslist){if(jslist[i]&&jslist[i].innerHTML){var code=jslist[i].innerHTML;var parent=jslist[i].parentNode;var span=$a(parent,'span');parent.replaceChild(span,jslist[i]);var val=code?eval(code):'';if(!val||typeof(val)=='object'){val='';}

View file

@ -189,7 +189,17 @@ $.extend(_p, {
Display draft in header if true
*/
show_draft: function(args) {
if(args.doc && cint(args.doc.docstatus)==0 && cur_frm.perm[0][SUBMIT]) {
var is_doctype_submittable = 0;
var plist = locals['DocPerm'];
for(var perm in plist) {
var p = plist[perm];
if((p.parent==args.doc.doctype) && (p.submit==1)){
is_doctype_submittable = 1;
break;
}
}
if(args.doc && cint(args.doc.docstatus)==0 && is_doctype_submittable) {
draft = _p.head_banner_format();
draft = draft.replace("{{HEAD}}", "DRAFT");
draft = draft.replace("{{DESCRIPTION}}", "This box will go away after the document is submitted.");

View file

@ -5,14 +5,14 @@
{
'creation': '2009-05-12 16:43:58',
'docstatus': 0,
'modified': '2011-11-23 13:39:59',
'modified': '2011-12-05 11:45:45',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1321362800',
'_last_update': '1322035799',
'allow_attach': 0,
'allow_copy': 0,
'allow_email': 0,
@ -40,7 +40,7 @@
'subject': 'eval:("<span style=\'color:grey\'>Module: <b>%(module)s</b>, Type: <b>%(doc_type)s</b>, Standard: <b>%(standard)s</b></span>")',
'tag_fields': 'doc_type',
'use_template': 0,
'version': 24
'version': 25
},
# These values are common for all DocField
@ -99,7 +99,7 @@
'no_copy': 0,
'oldfieldname': 'module',
'oldfieldtype': 'Select',
'options': 'Module Def',
'options': 'link:Module Def',
'print_hide': 0,
'report_hide': 0,
'reqd': 1,

View file

@ -116,3 +116,6 @@ backup_link_path = '/var/www/wnframework/backups'
# url to be emailed to the "System Manager" Role to download
# the backup
backup_url = 'http://localhost/backups'
# System TimeZone (should be acceptable by pytz: Recommended format Continent/City)
system_timezone = 'Asia/Kolkata'

View file

@ -19,7 +19,7 @@ def make_html_body(content, template = None):
return template_html % {'content': content}
def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[], send_now=1, reply_to=None, template=None):
def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc=[], attach=[], send_now=1, reply_to=None, template=None, from_defs=0):
"""
send an html email as multipart with attachments and all
"""
@ -27,7 +27,7 @@ def sendmail(recipients, sender='', msg='', subject='[No Subject]', parts=[], cc
from webnotes.utils.email_lib.html2text import html2text
from webnotes.utils.email_lib.send import EMail
email = EMail(sender, recipients, subject, reply_to=reply_to)
email = EMail(sender, recipients, subject, reply_to=reply_to, from_defs=from_defs)
email.cc = cc
if msg:

View file

@ -138,6 +138,7 @@ class EMail:
setup the SMTP (outgoing) server from `Control Panel` or defs.py
"""
if self.from_defs:
import webnotes
self.server = getattr(webnotes.defs,'mail_server','')
self.login = getattr(webnotes.defs,'mail_login','')
self.port = getattr(webnotes.defs,'mail_port',None)