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

This commit is contained in:
Nabin Hait 2011-08-25 16:47:10 +05:30
commit 2c8c0c93fe
8 changed files with 200 additions and 522 deletions

View file

@ -5,25 +5,22 @@
{ {
'creation': '2009-05-12 11:19:11', 'creation': '2009-05-12 11:19:11',
'docstatus': 0, 'docstatus': 0,
'modified': '2010-12-21 11:07:20', 'modified': '2011-08-25 14:02:26',
'modified_by': 'sneha@webnotestech.com', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },
# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1303708853', '_last_update': '1311340897',
'allow_attach': 1, 'allow_attach': 1,
'allow_copy': 0, 'allow_copy': 0,
'allow_email': 0, 'allow_email': 0,
'allow_print': 0, 'allow_print': 0,
'client_script': 'cur_frm.cscript[\'Change Password\']= function(doc, cdt, cdn) {\n var error = false;\n if ((!doc.new_password)||(!doc.retype_new_password)){\n alert("Both fields are required!");\n error = true;\n }\n if (doc.new_password.length<4) {\n alert("Password must be atleast 4 characters long");\n error = true;\n }\n if(doc.new_password!=doc.retype_new_password) {\n alert("Passwords must match");\n error = true;\n }\n if(!/[A-Z]/.test(doc.new_password) || !/[0-9]/.test(doc.new_password) || !/[\\W_]/.test(doc.new_password)) {\n msgprint(\'New password must contain atleast 1 capital letter, 1 numeric and 1 special character.\');\n error = true;\n doc.new_password = \'\';\n refresh_field(\'new_password\');\n }\n if(!error) {\n cur_frm.runscript(\'update_password\', \'\', function(r,t) {\n\tdoc.new_password = \'\';\n\tdoc.retype_new_password = \'\';\n refresh_many([\'new_password\',\'retype_new_password\']);\n });\n }\n}\n\ncur_frm.cscript.validate = function(doc, cdt, cdn) {\n doc.new_password = \'\';\n doc.retype_new_password = \'\';\n}',
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'hide_heading': 0, 'hide_heading': 0,
'hide_toolbar': 0, 'hide_toolbar': 0,
'idx': 0,
'in_create': 1,
'issingle': 0, 'issingle': 0,
'istable': 0, 'istable': 0,
'max_attachments': 1, 'max_attachments': 1,
@ -31,10 +28,9 @@
'name': '__common__', 'name': '__common__',
'print_outline': 'Yes', 'print_outline': 'Yes',
'read_only': 0, 'read_only': 0,
'section_style': 'Tray', 'search_fields': 'first_name, last_name',
'server_code_error': ' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 25 'version': 32
}, },
# These values are common for all DocField # These values are common for all DocField
@ -69,7 +65,6 @@
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'execute': 0, 'execute': 0,
'idx': 1,
'permlevel': 0, 'permlevel': 0,
'role': 'Administrator', 'role': 'Administrator',
'submit': 0 'submit': 0
@ -79,7 +74,6 @@
{ {
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 2,
'permlevel': 0, 'permlevel': 0,
'role': 'System Manager' 'role': 'System Manager'
}, },
@ -87,7 +81,6 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 3,
'permlevel': 1, 'permlevel': 1,
'role': 'Administrator' 'role': 'Administrator'
}, },
@ -95,67 +88,17 @@
# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'idx': 4,
'match': 'owner', 'match': 'owner',
'permlevel': 0, 'permlevel': 0,
'role': 'All' 'role': 'All'
}, },
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'hidden': 0,
'idx': 1,
'label': 'Details',
'oldfieldtype': 'Section Break',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'hidden': 0,
'idx': 2,
'label': 'Picture',
'oldfieldtype': 'Column Break',
'permlevel': 0,
'reqd': 0,
'search_index': 0,
'width': '50%'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Image',
'idx': 3,
'label': 'Profile Picture',
'oldfieldtype': 'Image',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 4,
'label': 'Contact',
'oldfieldtype': 'Column Break',
'permlevel': 0,
'width': '50%'
},
# DocField # DocField
{ {
'default': '1', 'default': '1',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'enabled', 'fieldname': 'enabled',
'fieldtype': 'Check', 'fieldtype': 'Check',
'idx': 5,
'label': 'Enabled', 'label': 'Enabled',
'oldfieldname': 'enabled', 'oldfieldname': 'enabled',
'oldfieldtype': 'Check', 'oldfieldtype': 'Check',
@ -164,24 +107,40 @@
# DocField # DocField
{ {
'default': '1',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'send_email_invite', 'fieldname': 'password',
'fieldtype': 'Password',
'label': 'Password',
'permlevel': 1,
'hidden': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'registered',
'fieldtype': 'Check', 'fieldtype': 'Check',
'idx': 6, 'label': 'Registered',
'label': 'Send Email Invite', 'permlevel': 0,
'oldfieldname': 'send_email_invite', 'hidden': 1
'oldfieldtype': 'Check',
'permlevel': 1
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'unsubscribed',
'fieldtype': 'Check',
'label': 'Unsubscribed',
'permlevel': 0,
'hidden': 1
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'recent_documents', 'fieldname': 'recent_documents',
'fieldtype': 'Text', 'fieldtype': 'Text',
'hidden': 1, 'hidden': 1,
'idx': 8,
'label': 'Recent Documents', 'label': 'Recent Documents',
'oldfieldname': 'recent_documents', 'oldfieldname': 'recent_documents',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
@ -195,7 +154,6 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'first_name', 'fieldname': 'first_name',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 9,
'label': 'First Name', 'label': 'First Name',
'oldfieldname': 'first_name', 'oldfieldname': 'first_name',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -208,7 +166,6 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'middle_name', 'fieldname': 'middle_name',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 10,
'label': 'Middle Name (Optional)', 'label': 'Middle Name (Optional)',
'oldfieldname': 'middle_name', 'oldfieldname': 'middle_name',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -220,46 +177,17 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'last_name', 'fieldname': 'last_name',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 11,
'label': 'Last Name', 'label': 'Last Name',
'oldfieldname': 'last_name', 'oldfieldname': 'last_name',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
'permlevel': 0 'permlevel': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'hidden': 0,
'idx': 12,
'label': 'Email',
'oldfieldname': 'email',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'birth_date',
'fieldtype': 'Date',
'idx': 13,
'label': 'Birth Date',
'oldfieldname': 'birth_date',
'oldfieldtype': 'Date',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'gender', 'fieldname': 'gender',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 14,
'label': 'Gender', 'label': 'Gender',
'oldfieldname': 'gender', 'oldfieldname': 'gender',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@ -271,51 +199,74 @@
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'occupation', 'fieldtype': 'Column Break',
'fieldtype': 'Data', 'oldfieldtype': 'Column Break',
'idx': 15, 'permlevel': 1,
'label': 'Designation', 'width': '50%'
'oldfieldname': 'occupation',
'oldfieldtype': 'Data',
'permlevel': 0,
'search_index': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'email',
'fieldtype': 'Data',
'hidden': 0,
'label': 'Email',
'oldfieldname': 'email',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'bio', 'fieldname': 'bio',
'fieldtype': 'Text', 'fieldtype': 'Text',
'idx': 16,
'label': 'Bio', 'label': 'Bio',
'oldfieldname': 'bio', 'oldfieldname': 'bio',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
'permlevel': 0, 'permlevel': 0,
'search_index': 0 'search_index': 0,
'hidden': 1
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'interests', 'fieldname': 'interests',
'fieldtype': 'Text', 'fieldtype': 'Text',
'idx': 17,
'label': 'Interests', 'label': 'Interests',
'oldfieldname': 'interests', 'oldfieldname': 'interests',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
'permlevel': 0,
'hidden': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'birth_date',
'fieldtype': 'Date',
'label': 'Birth Date',
'oldfieldname': 'birth_date',
'oldfieldtype': 'Date',
'permlevel': 0 'permlevel': 0
}, },
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'activities', 'fieldname': 'activities',
'fieldtype': 'Text', 'fieldtype': 'Text',
'idx': 18,
'label': 'Activities', 'label': 'Activities',
'oldfieldname': 'activities', 'oldfieldname': 'activities',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
'permlevel': 0 'permlevel': 0,
'hidden': 1
}, },
# DocField # DocField
@ -323,7 +274,6 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'messanger_status', 'fieldname': 'messanger_status',
'fieldtype': 'Data', 'fieldtype': 'Data',
'idx': 19,
'label': 'Messanger Status', 'label': 'Messanger Status',
'oldfieldname': 'messanger_status', 'oldfieldname': 'messanger_status',
'oldfieldtype': 'Data', 'oldfieldtype': 'Data',
@ -331,60 +281,11 @@
'search_index': 0 'search_index': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'home_phone',
'fieldtype': 'Data',
'idx': 20,
'label': 'Home Phone',
'oldfieldname': 'home_phone',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'office_phone',
'fieldtype': 'Data',
'idx': 21,
'label': 'Office Phone',
'oldfieldname': 'office_phone',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'extension',
'fieldtype': 'Data',
'idx': 22,
'label': 'Extension',
'oldfieldname': 'extension',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'cell_no',
'fieldtype': 'Data',
'idx': 23,
'label': 'Cell No',
'oldfieldname': 'cell_no',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'user_type', 'fieldname': 'user_type',
'fieldtype': 'Select', 'fieldtype': 'Select',
'idx': 24,
'label': 'User Type', 'label': 'User Type',
'oldfieldname': 'user_type', 'oldfieldname': 'user_type',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
@ -392,150 +293,27 @@
'permlevel': 0 'permlevel': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'last_login',
'fieldtype': 'Read Only',
'hidden': 0,
'idx': 25,
'label': 'Last Login',
'oldfieldname': 'last_login',
'oldfieldtype': 'Read Only',
'permlevel': 0,
'reqd': 0,
'search_index': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'last_ip',
'fieldtype': 'Read Only',
'idx': 26,
'label': 'Last IP',
'oldfieldname': 'last_ip',
'oldfieldtype': 'Read Only',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 27,
'label': 'Address',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'line_1',
'fieldtype': 'Data',
'idx': 28,
'label': 'Line 1',
'oldfieldname': 'line_1',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'line_2',
'fieldtype': 'Data',
'idx': 29,
'label': 'Line 2',
'oldfieldname': 'line_2',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'city',
'fieldtype': 'Data',
'idx': 30,
'label': 'City / Town',
'oldfieldname': 'city',
'oldfieldtype': 'Data',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'district',
'fieldtype': 'Data',
'idx': 31,
'label': 'District',
'oldfieldname': 'district',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'state',
'fieldtype': 'Data',
'idx': 32,
'label': 'State',
'oldfieldname': 'state',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'country',
'fieldtype': 'Data',
'idx': 33,
'label': 'Country',
'oldfieldname': 'country',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'pin',
'fieldtype': 'Data',
'idx': 34,
'label': 'Pin',
'oldfieldname': 'pin',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 35,
'label': 'User Role',
'oldfieldtype': 'Section Break',
'permlevel': 1
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'hidden': 0, 'hidden': 0,
'idx': 36,
'label': 'Roles',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 1, 'permlevel': 1,
'reqd': 0, 'reqd': 0,
'search_index': 0 'search_index': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'label': 'Roles',
'oldfieldtype': 'Column Break',
'permlevel': 1,
'width': '50%'
},
# DocField # DocField
{ {
@ -545,7 +323,6 @@
'fieldname': 'userroles', 'fieldname': 'userroles',
'fieldtype': 'Table', 'fieldtype': 'Table',
'hidden': 0, 'hidden': 0,
'idx': 37,
'label': 'User Roles', 'label': 'User Roles',
'oldfieldname': 'userroles', 'oldfieldname': 'userroles',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@ -558,10 +335,9 @@
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Column Break',
'idx': 38,
'label': 'System Defaults', 'label': 'System Defaults',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Column Break',
'permlevel': 1, 'permlevel': 1,
'width': '50%' 'width': '50%'
}, },
@ -574,7 +350,6 @@
'fieldname': 'defaults', 'fieldname': 'defaults',
'fieldtype': 'Table', 'fieldtype': 'Table',
'hidden': 0, 'hidden': 0,
'idx': 39,
'label': 'Defaults', 'label': 'Defaults',
'oldfieldname': 'defaults', 'oldfieldname': 'defaults',
'oldfieldtype': 'Table', 'oldfieldtype': 'Table',
@ -588,9 +363,35 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'idx': 40, 'label': 'Login Details',
'label': 'Password',
'oldfieldtype': 'Section Break', 'oldfieldtype': 'Section Break',
'permlevel': 0,
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'login_before',
'fieldtype': 'Int',
'label': 'Login Before',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'login_after',
'fieldtype': 'Int',
'label': 'Login After',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'restrict_ip',
'fieldtype': 'Data',
'label': 'Restrict IP',
'permlevel': 0 'permlevel': 0
}, },
@ -598,25 +399,20 @@
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Column Break', 'fieldtype': 'Column Break',
'idx': 41,
'label': 'Change Your Password',
'oldfieldtype': 'Column Break', 'oldfieldtype': 'Column Break',
'permlevel': 1,
'width': '50%' 'width': '50%'
}, },
# DocField # DocField
{ {
'colour': 'Pink:FEF2EA',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'password', 'fieldname': 'last_login',
'fieldtype': 'Data', 'fieldtype': 'Read Only',
'hidden': 1, 'hidden': 0,
'idx': 42, 'label': 'Last Login',
'label': 'Current Password', 'oldfieldname': 'last_login',
'oldfieldname': 'password', 'oldfieldtype': 'Read Only',
'oldfieldtype': 'Data', 'permlevel': 0,
'permlevel': 1,
'reqd': 0, 'reqd': 0,
'search_index': 0 'search_index': 0
}, },
@ -624,139 +420,23 @@
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'new_password', 'fieldname': 'last_ip',
'fieldtype': 'Password', 'fieldtype': 'Read Only',
'idx': 43, 'label': 'Last IP',
'label': 'New Password', 'oldfieldname': 'last_ip',
'oldfieldname': 'new_password', 'oldfieldtype': 'Read Only',
'oldfieldtype': 'Password',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'retype_new_password',
'fieldtype': 'Password',
'idx': 44,
'label': 'Retype New Password',
'oldfieldname': 'retype_new_password',
'oldfieldtype': 'Password',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'password_last_updated',
'fieldtype': 'Date',
'hidden': 1,
'idx': 45,
'label': 'Password Last Updated',
'oldfieldname': 'password_last_updated',
'oldfieldtype': 'Date',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Button',
'idx': 46,
'label': 'Change Password',
'oldfieldtype': 'Button',
'permlevel': 1,
'trigger': 'Client',
'width': '120px'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 47,
'label': 'Attachment',
'oldfieldtype': 'Section Break',
'permlevel': 1
},
# DocField
{
'default': '0',
'doctype': 'DocField',
'fieldname': 'social_points',
'fieldtype': 'Int',
'idx': 48,
'label': 'Social Points',
'oldfieldname': 'social_points',
'oldfieldtype': 'Int',
'permlevel': 0 'permlevel': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'social_badge',
'fieldtype': 'Data',
'idx': 49,
'label': 'Social Badge',
'oldfieldname': 'social_badge',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'avatar',
'fieldtype': 'Data',
'idx': 50,
'label': 'Avatar',
'oldfieldname': 'avatar',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 51,
'label': 'Attachment HTML',
'oldfieldtype': 'HTML',
'options': 'First attachment must be the picture',
'permlevel': 1
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'file_list', 'fieldname': 'file_list',
'fieldtype': 'Text', 'fieldtype': 'Text',
'hidden': 1, 'hidden': 1,
'idx': 52,
'label': 'File List', 'label': 'File List',
'oldfieldname': 'file_list', 'oldfieldname': 'file_list',
'oldfieldtype': 'Text', 'oldfieldtype': 'Text',
'permlevel': 0 'permlevel': 0
}, }
# DocField
{
'doctype': 'DocField',
'fieldname': 'fiscal_year',
'fieldtype': 'Select',
'hidden': 1,
'idx': 53,
'in_filter': 1,
'label': 'Fiscal Year',
'no_copy': 1,
'oldfieldname': 'fiscal_year',
'oldfieldtype': 'Select',
'options': 'link:Fiscal Year',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1
}
] ]

View file

@ -87,10 +87,13 @@
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldname': 'criteria_name',
'idx': 1, 'fieldtype': 'Data',
'label': 'Details', 'hidden': 0,
'oldfieldtype': 'Section Break', 'idx': 5,
'label': 'Criteria Name',
'oldfieldname': 'criteria_name',
'oldfieldtype': 'Data',
'permlevel': 0 'permlevel': 0
}, },
@ -135,41 +138,6 @@
'search_index': 1 'search_index': 1
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'criteria_name',
'fieldtype': 'Data',
'hidden': 0,
'idx': 5,
'label': 'Criteria Name',
'oldfieldname': 'criteria_name',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'description',
'fieldtype': 'Text',
'idx': 6,
'label': 'Description',
'oldfieldname': 'description',
'oldfieldtype': 'Text',
'permlevel': 0,
'width': '300px'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 7,
'label': 'Query Details',
'oldfieldtype': 'Section Break',
'permlevel': 0
},
# DocField # DocField
{ {
@ -189,7 +157,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'filters', 'fieldname': 'filters',
'fieldtype': 'Text', 'fieldtype': 'Text',
'hidden': 0, 'hidden': 1,
'idx': 9, 'idx': 9,
'label': 'Filters', 'label': 'Filters',
'oldfieldname': 'filters', 'oldfieldname': 'filters',
@ -288,32 +256,6 @@
'permlevel': 0 'permlevel': 0
}, },
# DocField
{
'doctype': 'DocField',
'fieldname': 'graph_series',
'fieldtype': 'Data',
'hidden': 0,
'idx': 17,
'label': 'Graph Series',
'oldfieldname': 'graph_series',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'graph_values',
'fieldtype': 'Data',
'hidden': 0,
'idx': 18,
'label': 'Graph Values',
'oldfieldname': 'graph_values',
'oldfieldtype': 'Data',
'permlevel': 0
},
# DocField # DocField
{ {
'doctype': 'DocField', 'doctype': 'DocField',

View file

@ -127,8 +127,9 @@ class LoginManager:
# --------------------------- # ---------------------------
def post_login(self): def post_login(self):
self.validate_ip_address()
self.run_trigger() self.run_trigger()
self.validate_ip_address()
self.validate_hour()
# check password # check password
# -------------- # --------------
@ -186,16 +187,38 @@ class LoginManager:
# ------------- # -------------
def validate_ip_address(self): def validate_ip_address(self):
try: ip_list = webnotes.conn.get_value('Profile', self.user, 'restrict_ip', ignore=True)
ip = webnotes.conn.sql("select ip_address from tabProfile where name = '%s'" % self.user)[0][0] or ''
except: return if not ip_list:
return
ip_list = ip_list.replace(",", "\n").split('\n')
ip_list = [i.strip() for i in ip_list]
for ip in ip_list:
if webnotes.remote_ip.startswith(ip):
return
ip = ip.replace(",", "\n").split('\n') webnotes.msgprint('Not allowed from this IP Address', raise_exception=1)
ip = [i.strip() for i in ip]
def validate_hour(self):
"""
check if user is logging in during restricted hours
"""
login_before = int(webnotes.conn.get_value('Profile', self.user, 'login_before', ignore=True) or 0)
login_after = int(webnotes.conn.get_value('Profile', self.user, 'login_after', ignore=True) or 0)
if not (login_before or login_after):
return
if ret and ip: from webnotes.utils import now_datetime
if not (webnotes.remote_ip.startswith(ip[0]) or (webnotes.remote_ip in ip)): current_hour = int(now_datetime().strftime('%H'))
raise Exception, 'Not allowed from this IP Address'
if login_before and current_hour > login_before:
webnotes.msgprint('Not allowed to login after restricted hour', raise_exception=1)
if login_after and current_hour < login_after:
webnotes.msgprint('Not allowed to login before restricted hour', raise_exception=1)
# login as guest # login as guest
# -------------- # --------------

View file

@ -255,7 +255,7 @@ class Database:
# ====================================================================================== # ======================================================================================
# get a single value from a record # get a single value from a record
def get_value(self, doctype, docname, fieldname): def get_value(self, doctype, docname, fieldname, ignore=None):
""" """
Get a single / multiple value from a record. Get a single / multiple value from a record.
@ -266,8 +266,13 @@ class Database:
if docname and (docname!=doctype or docname=='DocType'): if docname and (docname!=doctype or docname=='DocType'):
if type(fieldname) in (list, tuple): if type(fieldname) in (list, tuple):
fl = '`, `'.join(fieldname) fl = '`, `'.join(fieldname)
try:
r = self.sql("select `%s` from `tab%s` where name='%s'" % (fl, doctype, docname)) r = self.sql("select `%s` from `tab%s` where name='%s'" % (fl, doctype, docname))
except Exception, e:
if e.args[0]==1054 and ignore:
return None
else:
raise e
return r and (len(r[0]) > 1 and r[0] or r[0][0]) or None return r and (len(r[0]) > 1 and r[0] or r[0][0]) or None
else: else:
if type(fieldname) in (list, tuple): if type(fieldname) in (list, tuple):

View file

@ -186,9 +186,11 @@ def commonify_doclist(doclist, with_comments=1):
c[k] = doclist[0][k] c[k] = doclist[0][k]
return c return c
def strip_common(d): def strip_common_and_idx(d):
for k in common_keys: for k in common_keys:
if k in d: del d[k] if k in d: del d[k]
if 'idx' in d: del d['idx']
return d return d
def make_common_dicts(doclist): def make_common_dicts(doclist):
@ -211,7 +213,7 @@ def commonify_doclist(doclist, with_comments=1):
# make docs # make docs
final = [] final = []
for d in doclist: for d in doclist:
f = strip_common(get_diff_dict(common_dict[d['doctype']], d)) f = strip_common_and_idx(get_diff_dict(common_dict[d['doctype']], d))
f['doctype'] = d['doctype'] # keep doctype! f['doctype'] = d['doctype'] # keep doctype!
# strip name for child records (only an auto generated number!) # strip name for child records (only an auto generated number!)
@ -228,7 +230,7 @@ def commonify_doclist(doclist, with_comments=1):
d['name']='__common__' d['name']='__common__'
if with_comments: if with_comments:
d['##comment'] = 'These values are common for all ' + d['doctype'] d['##comment'] = 'These values are common for all ' + d['doctype']
commons.append(strip_common(d)) commons.append(strip_common_and_idx(d))
common_values = make_common(doclist) common_values = make_common(doclist)
return [common_values]+commons+final return [common_values]+commons+final
@ -237,18 +239,32 @@ def uncommonify_doclist(dl):
""" """
Expands an commonified doclist Expands an commonified doclist
""" """
# first one has common values
common_values = dl[0] common_values = dl[0]
common_dict = {} common_dict = {}
final = [] final = []
idx_dict = {}
for d in dl[1:]: for d in dl[1:]:
if 'name' in d and d['name']=='__common__': if 'name' in d and d['name']=='__common__':
# common for a doctype -
del d['name'] del d['name']
common_dict[d['doctype']] = d common_dict[d['doctype']] = d
else: else:
dt = d['doctype']
if not dt in idx_dict: idx_dict[dt] = 0;
d1 = common_values.copy() d1 = common_values.copy()
d1.update(common_dict[d['doctype']])
# update from common and global
d1.update(common_dict[dt])
d1.update(d) d1.update(d)
# idx by sequence
d1['idx'] = idx_dict[dt]
# increment idx
idx_dict[dt] += 1
final.append(d1) final.append(d1)
return final return final

View file

@ -121,7 +121,8 @@ if(this.docname){if(!this.check_doc_perm())return;if(!this.setup_done)this.setup
if(this.doc.__islocal) if(this.doc.__islocal)
this.is_editable[this.docname]=1;this.editable=this.is_editable[this.docname];if(!this.doc.__archived&&(this.editable||(!this.editable&&this.meta.istable))){if(this.print_wrapper){$dh(this.print_wrapper);$ds(this.page_layout.wrapper);} this.is_editable[this.docname]=1;this.editable=this.is_editable[this.docname];if(!this.doc.__archived&&(this.editable||(!this.editable&&this.meta.istable))){if(this.print_wrapper){$dh(this.print_wrapper);$ds(this.page_layout.wrapper);}
if(!this.meta.istable){this.refresh_header();this.sidebar&&this.sidebar.refresh();} if(!this.meta.istable){this.refresh_header();this.sidebar&&this.sidebar.refresh();}
this.runclientscript('refresh');this.refresh_tabs();this.refresh_fields();this.refresh_dependency();this.refresh_footer();if(this.layout)this.layout.show();if(is_onload) this.runclientscript('refresh');$(document).trigger('form_refresh')
this.refresh_tabs();this.refresh_fields();this.refresh_dependency();this.refresh_footer();if(this.layout)this.layout.show();if(is_onload)
this.runclientscript('onload_post_render',this.doctype,this.docname);}else{this.refresh_header();if(this.print_wrapper){this.refresh_print_layout();} this.runclientscript('onload_post_render',this.doctype,this.docname);}else{this.refresh_header();if(this.print_wrapper){this.refresh_print_layout();}
this.runclientscript('edit_status_changed');} this.runclientscript('edit_status_changed');}
if(!this.display)this.show_the_frm();if(!this.meta.in_dialog)page_body.change_to('Forms');}} if(!this.display)this.show_the_frm();if(!this.meta.in_dialog)page_body.change_to('Forms');}}

View file

@ -622,6 +622,11 @@ _f.Frm.prototype.refresh = function(docname) {
// call trigger // call trigger
this.runclientscript('refresh'); this.runclientscript('refresh');
// trigger global trigger
// to use this
// $(docuemnt).bind('form_refresh', function() { })
$(document).trigger('form_refresh')
// tabs // tabs
this.refresh_tabs(); this.refresh_tabs();

View file

@ -507,7 +507,13 @@ _r.ReportBuilder.prototype.set_sort_options = function(l) {
empty_select(this.dt.sort_sel); empty_select(this.dt.sort_sel);
if(l) sl = add_lists(l, this.orig_sort_list) if(l) sl = add_lists(l, this.orig_sort_list);
// no sorts, add one
if(!l.length) {
l.push(['ID', 'name'])
}
for(var i=0; i<sl.length; i++) { for(var i=0; i<sl.length; i++) {
this.dt.add_sort_option(sl[i][0], sl[i][1]); this.dt.add_sort_option(sl[i][0], sl[i][1]);
} }