ソースを参照

Merge pull request #53 from anandpdoshi/master

DocLayer functionality
version-14
Anand Doshi 13年前
コミット
d0145ea400
7個のファイルの変更192行の追加36行の削除
  1. +115
    -4
      py/core/doctype/doclayer/doclayer.js
  2. +0
    -1
      py/core/doctype/doclayer/doclayer.py
  3. +14
    -15
      py/core/doctype/doclayer/doclayer.txt
  4. +0
    -0
      py/core/doctype/doclayerfield/doclayerfield.py
  5. +16
    -5
      py/core/doctype/doclayerfield/doclayerfield.txt
  6. +46
    -10
      py/core/doctype/print_format/print_format.txt
  7. +1
    -1
      py/webnotes/model/doctype.py

+ 115
- 4
py/core/doctype/doclayer/doclayer.js ファイルの表示

@@ -13,13 +13,17 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
p = cur_frm.grids[0].grid.tbar_tab.children[0].children[0]; p = cur_frm.grids[0].grid.tbar_tab.children[0].children[0];
p.removeChild(p.children[0]) p.removeChild(p.children[0])
p.removeChild(p.children[0]) p.removeChild(p.children[0])
cur_frm.tip_wrapper.id = 'tip_wrapper';
cur_frm.add_fields_help();
} }


cur_frm.cscript.refresh = function(doc, dt, dn) { cur_frm.cscript.refresh = function(doc, dt, dn) {
//console.log(p) //console.log(p)
cur_frm.frm_head.timestamp_area.hidden = 1;
cur_frm.frm_head.page_head.buttons.Save.hidden=1;
cur_frm.page_layout.footer.hidden = 1;
cur_frm.frm_head.timestamp_area.hidden = true;
cur_frm.frm_head.page_head.buttons.Save.hidden = true;
cur_frm.page_layout.footer.hidden = true;
if(doc.doc_type) { $('#tip_wrapper').slideUp('slow'); }

cur_frm.add_custom_button('Update', function() { cur_frm.add_custom_button('Update', function() {
if(cur_frm.fields_dict['doc_type'].value) { if(cur_frm.fields_dict['doc_type'].value) {
$c_obj(make_doclist(dt, dn), 'post', '', function(r, rt) { $c_obj(make_doclist(dt, dn), 'post', '', function(r, rt) {
@@ -37,7 +41,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
},1); },1);
cur_frm.frm_head.page_head.buttons.Update.className = "cupid-green"; cur_frm.frm_head.page_head.buttons.Update.className = "cupid-green";
cur_frm.add_custom_button('Reload', function() {
cur_frm.add_custom_button('Refresh Form', function() {
cur_frm.cscript.doc_type(doc, dt, dn); cur_frm.cscript.doc_type(doc, dt, dn);
}, 1); }, 1);
@@ -45,8 +49,18 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.confirm('This will <b>remove the customizations</b> defined for this form.<br /><br />' cur_frm.confirm('This will <b>remove the customizations</b> defined for this form.<br /><br />'
+ 'Are you sure you want to <i>reset to defaults</i>?', doc, dt, dn); + 'Are you sure you want to <i>reset to defaults</i>?', doc, dt, dn);
}, 1); }, 1);

if(!doc.doc_type) {
cur_frm.set_tip('You can start by selecting a Form Type from the drop down menu')
$('#tip_wrapper').fadeIn();
var page_head = cur_frm.frm_head.page_head;
page_head.buttons['Update'].disabled = true;
page_head.buttons['Refresh Form'].disabled = true;
page_head.buttons['Reset to defaults'].disabled = true;
}
} }



cur_frm.confirm = function(msg, doc, dt, dn) { cur_frm.confirm = function(msg, doc, dt, dn) {
var d = new wn.widgets.Dialog({ var d = new wn.widgets.Dialog({
title: 'Reset To Defaults', title: 'Reset To Defaults',
@@ -88,3 +102,100 @@ cur_frm.confirm = function(msg, doc, dt, dn) {
cur_frm.confirm.dialog = d; cur_frm.confirm.dialog = d;
d.show(); d.show();
} }


cur_frm.add_fields_help = function() {
$(cur_frm.grids[0].parent).before(
'<div style="padding: 10px">\
<a id="fields_help" class="link_type">Help</a>\
</div>');
$('#fields_help').click(function() {
var d = new wn.widgets.Dialog({
title: 'Help: Field Properties',
width: 600
});

var help =
"<table cellspacing='25'>\
<tr>\
<td><b>Label</b></td>\
<td>Set the display label for the field</td>\
</tr>\
<tr>\
<td width='25%'><b>Options</b></td>\
<td width='75%'>Specify the value of the field</td>\
</tr>\
<tr>\
<td><b>Perm Level</b></td>\
<td>\
Assign a permission level to the field.<br />\
(Permissions can be managed via Setup &gt; Permission Manager)\
</td>\
</tr>\
<tr>\
<td><b>Width</b></td>\
<td>\
Width of the input box<br />\
Example: <i>120px</i>\
</td>\
</tr>\
<tr>\
<td><b>Reqd</b></td>\
<td>Mark the field as Mandatory</td>\
</tr>\
<tr>\
<td><b>In Filter</b></td>\
<td>Use the field to filter records</td>\
</tr>\
<tr>\
<td><b>Hidden</b></td>\
<td>Hide field in form</td>\
</tr>\
<tr>\
<td><b>Print Hide</b></td>\
<td>Hide field in Standard Print Format</td>\
</tr>\
<tr>\
<td><b>Report Hide</b></td>\
<td>Hide field in Report Builder</td>\
</tr>\
<tr>\
<td><b>Allow on Submit</b></td>\
<td>Allow field to remain editable even after submission</td>\
</tr>\
<tr>\
<td><b>Depends On</b></td>\
<td>\
Show field if a condition is met<br />\
Example: <code>eval:doc.status=='Cancelled'</code>\
on a field like \"reason_for_cancellation\" will reveal \
\"Reason for Cancellation\" only if the record is Cancelled.\
</td>\
</tr>\
<tr>\
<td><b>Description</b></td>\
<td>Show a description below the field</td>\
</tr>\
<tr>\
<td><b>Default</b></td>\
<td>Specify a default value</td>\
</tr>\
<tr>\
<td></td>\
<td><a class='link_type' \
onclick='cur_frm.fields_help_dialog.hide()'\
style='color:grey'>Press Esc to close</a>\
</td>\
</tr>\
</table>"
$y(d.body, {padding: '32px', textAlign: 'center', lineHeight: '200%'});

$a(d.body, 'div', '', {textAlign: 'left'}, help);

d.show();

cur_frm.fields_help_dialog = d;

});
}

+ 0
- 1
py/core/doctype/doclayer/doclayer.py ファイルの表示

@@ -16,7 +16,6 @@ class DocType:
'allow_print', 'allow_print',
'allow_email', 'allow_email',
'allow_copy', 'allow_copy',
'allow_rename',
'allow_attach', 'allow_attach',
'max_attachments' 'max_attachments'
] ]


+ 14
- 15
py/core/doctype/doclayer/doclayer.txt ファイルの表示

@@ -5,14 +5,14 @@
{ {
'creation': '2011-11-16 16:09:34', 'creation': '2011-11-16 16:09:34',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-11-17 16:38:45',
'modified': '2011-11-23 18:01:26',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },


# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1321528082',
'_last_update': '1322050979',
'autoname': 'DL.####', 'autoname': 'DL.####',
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
@@ -22,8 +22,8 @@
'name': '__common__', 'name': '__common__',
'search_fields': 'doc_type', 'search_fields': 'doc_type',
'section_style': 'Simple', 'section_style': 'Simple',
'show_in_menu': 1,
'version': 21
'show_in_menu': 0,
'version': 74
}, },


# These values are common for all DocField # These values are common for all DocField
@@ -79,7 +79,7 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'doc_type', 'fieldname': 'doc_type',
'fieldtype': 'Select', 'fieldtype': 'Select',
'label': 'Type',
'label': 'Select Form Type',
'options': 'Link:DocType', 'options': 'Link:DocType',
'permlevel': 0 'permlevel': 0
}, },
@@ -101,15 +101,18 @@


# DocField # DocField
{ {
'description': 'E.g.<br />\nBased on field - <b>field:customer_name</b><br />\nBased on number series: <b>TRN.####</b>',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'autoname', 'fieldname': 'autoname',
'fieldtype': 'Data', 'fieldtype': 'Data',
'hidden': 1,
'label': 'Auto Name', 'label': 'Auto Name',
'permlevel': 0
'permlevel': 2
}, },


# DocField # DocField
{ {
'description': 'Fields separated by comma (,) will be included in the<br /><b>Search By</b> list of Search dialog box',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'search_fields', 'fieldname': 'search_fields',
'fieldtype': 'Data', 'fieldtype': 'Data',
@@ -119,6 +122,7 @@


# DocField # DocField
{ {
'description': 'Fields separated by comma (,) will be set as tags',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'tag_fields', 'fieldname': 'tag_fields',
'fieldtype': 'Data', 'fieldtype': 'Data',
@@ -145,6 +149,7 @@


# DocField # DocField
{ {
'description': 'Load Print View on opening of an existing form',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'read_only_onload', 'fieldname': 'read_only_onload',
'fieldtype': 'Check', 'fieldtype': 'Check',
@@ -181,15 +186,7 @@


# DocField # DocField
{ {
'doctype': 'DocField',
'fieldname': 'allow_rename',
'fieldtype': 'Check',
'label': 'Allow Rename',
'permlevel': 0
},

# DocField
{
'description': 'Note: maximum attachment size = 1mb',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'allow_attach', 'fieldname': 'allow_attach',
'fieldtype': 'Check', 'fieldtype': 'Check',
@@ -199,6 +196,7 @@


# DocField # DocField
{ {
'depends_on': 'eval:doc.allow_attach',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'max_attachments', 'fieldname': 'max_attachments',
'fieldtype': 'Int', 'fieldtype': 'Int',
@@ -208,6 +206,7 @@


# DocField # DocField
{ {
'description': 'Customize Label, Print Hide, Default etc.',
'doctype': 'DocField', 'doctype': 'DocField',
'fieldtype': 'Section Break', 'fieldtype': 'Section Break',
'label': 'Fields', 'label': 'Fields',


+ 0
- 0
py/core/doctype/doclayerfield/doclayerfield.py ファイルの表示


+ 16
- 5
py/core/doctype/doclayerfield/doclayerfield.txt ファイルの表示

@@ -5,7 +5,7 @@
{ {
'creation': '2011-11-16 16:45:16', 'creation': '2011-11-16 16:45:16',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-11-22 16:09:21',
'modified': '2011-11-23 13:43:17',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },
@@ -27,7 +27,7 @@
'read_only': 0, 'read_only': 0,
'section_style': 'Simple', 'section_style': 'Simple',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 3
'version': 4
}, },


# These values are common for all DocField # These values are common for all DocField
@@ -48,8 +48,7 @@
'parent': 'DocLayerField', 'parent': 'DocLayerField',
'parentfield': 'permissions', 'parentfield': 'permissions',
'parenttype': 'DocType', 'parenttype': 'DocType',
'read': 1,
'role': 'System Manager'
'read': 1
}, },


# DocType, DocLayerField # DocType, DocLayerField
@@ -63,6 +62,7 @@
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'permlevel': 0, 'permlevel': 0,
'role': 'System Manager',
'write': 1 'write': 1
}, },


@@ -71,13 +71,24 @@
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'permlevel': 1, 'permlevel': 1,
'role': 'System Manager',
'write': 1 'write': 1
}, },


# DocPerm # DocPerm
{ {
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'permlevel': 2
'permlevel': 2,
'role': 'System Manager'
},

# DocPerm
{
'create': 1,
'doctype': 'DocPerm',
'permlevel': 2,
'role': 'Administrator',
'write': 1
}, },


# DocField # DocField


+ 46
- 10
py/core/doctype/print_format/print_format.txt ファイルの表示

@@ -3,33 +3,44 @@


# These values are common in all dictionaries # These values are common in all dictionaries
{ {
'creation': '2009-05-12 11:19:11',
'creation': '2009-05-12 16:43:58',
'docstatus': 0, 'docstatus': 0,
'modified': '2011-11-15 17:56:52',
'modified': '2011-11-23 13:39:59',
'modified_by': 'Administrator', 'modified_by': 'Administrator',
'owner': 'Administrator' 'owner': 'Administrator'
}, },


# These values are common for all DocType # These values are common for all DocType
{ {
'_last_update': '1321354395',
'_last_update': '1321362800',
'allow_attach': 0,
'allow_copy': 0, 'allow_copy': 0,
'allow_email': 0, 'allow_email': 0,
'allow_print': 0, 'allow_print': 0,
'allow_rename': 0,
'allow_trash': 0,
'autoname': 'Prompt', 'autoname': 'Prompt',
'colour': 'White:FFF', 'colour': 'White:FFF',
'doctype': 'DocType', 'doctype': 'DocType',
'hide_heading': 0, 'hide_heading': 0,
'hide_toolbar': 0, 'hide_toolbar': 0,
'in_create': 0,
'in_dialog': 0,
'is_transaction_doc': 0,
'issingle': 0, 'issingle': 0,
'istable': 0, 'istable': 0,
'max_attachments': 0,
'module': 'Core', 'module': 'Core',
'name': '__common__', 'name': '__common__',
'read_only': 0, 'read_only': 0,
'read_only_onload': 0,
'section_style': 'Simple', 'section_style': 'Simple',
'server_code_error': ' ', 'server_code_error': ' ',
'show_in_menu': 0, 'show_in_menu': 0,
'version': 10
'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
}, },


# These values are common for all DocField # These values are common for all DocField
@@ -48,14 +59,12 @@
'cancel': 0, 'cancel': 0,
'create': 1, 'create': 1,
'doctype': 'DocPerm', 'doctype': 'DocPerm',
'execute': 0,
'name': '__common__', 'name': '__common__',
'parent': 'Print Format', 'parent': 'Print Format',
'parentfield': 'permissions', 'parentfield': 'permissions',
'parenttype': 'DocType', 'parenttype': 'DocType',
'permlevel': 0, 'permlevel': 0,
'read': 1, 'read': 1,
'role': 'System Manager',
'submit': 0, 'submit': 0,
'write': 1 'write': 1
}, },
@@ -68,19 +77,33 @@


# DocPerm # DocPerm
{ {
'doctype': 'DocPerm'
'doctype': 'DocPerm',
'role': 'Administrator'
},

# DocPerm
{
'doctype': 'DocPerm',
'role': 'System Manager'
}, },


# DocField # DocField
{ {
'allow_on_submit': 0,
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'module', 'fieldname': 'module',
'fieldtype': 'Select', 'fieldtype': 'Select',
'hidden': 0,
'in_filter': 1,
'label': 'Module', 'label': 'Module',
'no_copy': 0,
'oldfieldname': 'module', 'oldfieldname': 'module',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
'options': 'link:Module Def',
'reqd': 1
'options': 'Module Def',
'print_hide': 0,
'report_hide': 0,
'reqd': 1,
'search_index': 1
}, },


# DocField # DocField
@@ -89,33 +112,46 @@
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'doc_type', 'fieldname': 'doc_type',
'fieldtype': 'Select', 'fieldtype': 'Select',
'in_filter': 1,
'label': 'DocType', 'label': 'DocType',
'options': 'link:DocType', 'options': 'link:DocType',
'reqd': 0
'reqd': 0,
'search_index': 0
}, },


# DocField # DocField
{ {
'allow_on_submit': 0,
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'standard', 'fieldname': 'standard',
'fieldtype': 'Select', 'fieldtype': 'Select',
'hidden': 0,
'in_filter': 1,
'label': 'Standard', 'label': 'Standard',
'no_copy': 0,
'oldfieldname': 'standard', 'oldfieldname': 'standard',
'oldfieldtype': 'Select', 'oldfieldtype': 'Select',
'options': '\nYes\nNo', 'options': '\nYes\nNo',
'print_hide': 0,
'report_hide': 0,
'reqd': 1, 'reqd': 1,
'search_index': 1 'search_index': 1
}, },


# DocField # DocField
{ {
'allow_on_submit': 0,
'doctype': 'DocField', 'doctype': 'DocField',
'fieldname': 'html', 'fieldname': 'html',
'fieldtype': 'Code', 'fieldtype': 'Code',
'hidden': 0, 'hidden': 0,
'in_filter': 0,
'label': 'HTML', 'label': 'HTML',
'no_copy': 0,
'oldfieldname': 'html', 'oldfieldname': 'html',
'oldfieldtype': 'Text Editor', 'oldfieldtype': 'Text Editor',
'print_hide': 0,
'report_hide': 0,
'reqd': 0, 'reqd': 0,
'search_index': 0 'search_index': 0
} }

+ 1
- 1
py/webnotes/model/doctype.py ファイルの表示

@@ -235,7 +235,7 @@ class _DocType:
# override properties in the main doctype # override properties in the main doctype
if dt in property_dict: if dt in property_dict:
for p in property_dict[self.name]:
for p in property_dict[dt]:
doclist[0].fields[p['property']] = p['value'] doclist[0].fields[p['property']] = p['value']




読み込み中…
キャンセル
保存