cleanup of form, rename, route, added fonts
This commit is contained in:
parent
9d0fc767b2
commit
9b1afe197d
@ -69,6 +69,7 @@
|
||||
"lib/css/legacy/sidebar.css",
|
||||
"lib/css/Aristo/aristo.selected.css",
|
||||
"lib/css/ui/list.css",
|
||||
"lib/css/ui/fonts.css",
|
||||
"lib/css/bootstrap/headings.css",
|
||||
"lib/css/bootstrap/buttons.css",
|
||||
"lib/css/bootstrap/navbar.css",
|
||||
@ -140,7 +141,6 @@
|
||||
"lib/js/wn/ui/dialog.js",
|
||||
"lib/js/wn/ui/button.js",
|
||||
"lib/js/legacy/widgets/dialog.js",
|
||||
"lib/js/legacy/widgets/listing.js",
|
||||
"lib/js/legacy/widgets/layout.js",
|
||||
"lib/js/legacy/widgets/tabbedpage.js",
|
||||
"lib/js/legacy/webpage/page_header.js",
|
||||
@ -159,7 +159,7 @@
|
||||
"lib/js/legacy/model/doclist.js",
|
||||
"lib/js/wn/ui/toolbar.min.js:concat",
|
||||
"lib/js/legacy/widgets/form/fields.js",
|
||||
"lib/js/legacy/widgets/form/form_container.js",
|
||||
"lib/js/legacy/widgets/form/form_dialog.js",
|
||||
"lib/js/legacy/widgets/form/form_header.js",
|
||||
"lib/js/legacy/widgets/form/form.js",
|
||||
"lib/js/legacy/widgets/form/form_fields.js",
|
||||
|
@ -217,6 +217,7 @@ div.std-footer-item {
|
||||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
@ -229,7 +230,7 @@ div.std-footer-item {
|
||||
float: left;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
box-shadow: 7px 0px 6px -2px #ddd;
|
||||
@ -241,7 +242,7 @@ div.std-footer-item {
|
||||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
@ -1101,9 +1102,8 @@ div.psidebar div.section {
|
||||
}
|
||||
|
||||
div.psidebar div.section-head {
|
||||
font-size: 12px;
|
||||
padding: 5px 11px;
|
||||
border-bottom: 2px solid #444;
|
||||
border-bottom: 2px solid #777;
|
||||
}
|
||||
|
||||
div.psidebar div.section-body {
|
||||
@ -1739,6 +1739,23 @@ div.stat-bar {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* lib/css/ui/fonts.css
|
||||
*/
|
||||
@font-face {
|
||||
font-family: 'Pontano Sans';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
src: url('../lib/css/fonts/pontanosans.woff') format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Droid Sans';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Droid Sans'), local('DroidSans'), url('../lib/css/fonts/droidsans.woff') format('woff');
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/bootstrap/headings.css
|
||||
*/
|
||||
@ -1808,6 +1825,7 @@ h6 {
|
||||
* lib/css/bootstrap/buttons.css
|
||||
*/
|
||||
.close {
|
||||
font-family: Helvetica, Sans;
|
||||
float: right;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
|
@ -217,6 +217,7 @@ div.std-footer-item {
|
||||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
@ -229,7 +230,7 @@ div.std-footer-item {
|
||||
float: left;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
box-shadow: 7px 0px 6px -2px #ddd;
|
||||
@ -241,7 +242,7 @@ div.std-footer-item {
|
||||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
min-height: 450px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
@ -490,6 +491,7 @@ h6 {
|
||||
* lib/css/bootstrap/buttons.css
|
||||
*/
|
||||
.close {
|
||||
font-family: Helvetica, Sans;
|
||||
float: right;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
|
@ -1,155 +0,0 @@
|
||||
# Module Def, Buying
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2011-07-01 17:40:38',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-01-10 17:52:19',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'name': '__common__',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def Item
|
||||
{
|
||||
'doctype': 'Module Def Item',
|
||||
'name': '__common__',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
|
||||
# These values are common for all Module Def
|
||||
{
|
||||
'disabled': 'No',
|
||||
'doctype': u'Module Def',
|
||||
'doctype_list': 'DocType Mapper, Purchase Receipt-Payable Voucher\nDocType Mapper, Purchase Order-Payable Voucher\nDocType Mapper, Purchase Order-Purchase Receipt\nDocType Mapper, Indent-Purchase Order\nPrint Format, Purchase Order Format\nPrint Format, Purchase Receipt Format\nDocType Label, Indent',
|
||||
'file_list': 'scm.gif,FileData/00209',
|
||||
'is_hidden': 'No',
|
||||
'module_desc': '<p>All details about your Suppliers and past transactions</p>',
|
||||
'module_icon': 'Buying.gif',
|
||||
'module_label': 'Buying',
|
||||
'module_name': 'Buying',
|
||||
'module_seq': 4,
|
||||
'name': '__common__'
|
||||
},
|
||||
|
||||
# Module Def, Buying
|
||||
{
|
||||
'doctype': u'Module Def',
|
||||
'name': 'Buying'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'description': 'Your Supplier Database',
|
||||
'display_name': 'Supplier',
|
||||
'doc_name': 'Supplier',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nsupplier_type\nsupplier_status\ncompany'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'description': 'Buy requests from various people in your company',
|
||||
'display_name': 'Indent',
|
||||
'doc_name': 'Indent',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\ntransaction_date\nsales_order_no\nremark'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'description': 'Orders you have placed to your suppliers',
|
||||
'display_name': 'Purchase Order',
|
||||
'doc_name': 'Purchase Order',
|
||||
'doc_type': 'Forms',
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\nsupplier\ntransaction_date\ngrand_total'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Itemwise Receipt Details',
|
||||
'doc_name': 'Purchase Receipt Detail',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Purchase in Transit',
|
||||
'doc_name': 'PV Detail',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Pending PO Items To Receive',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Pending PO Items To Bill',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'display_name': 'Itemwise Purchase Details',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item'
|
||||
},
|
||||
|
||||
# Module Def Item
|
||||
{
|
||||
'description': 'Ledger details of your creditors',
|
||||
'display_name': "Creditor's Ledger",
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'doctype': 'Module Def Item',
|
||||
'icon': 'accept.gif'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Purchase User'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Purchase Manager'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Administrator'
|
||||
},
|
||||
|
||||
# Module Def Role
|
||||
{
|
||||
'doctype': 'Module Def Role',
|
||||
'role': 'Purchase Master Manager'
|
||||
}
|
||||
]
|
@ -58,15 +58,6 @@ cur_frm.cscript.make_address = function() {
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.supplier = cur_frm.doc.name;
|
||||
ndoc.supplier_name = cur_frm.doc.supplier_name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
@ -100,14 +91,6 @@ cur_frm.cscript.make_contact = function() {
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.supplier = cur_frm.doc.name;
|
||||
ndoc.supplier_name = cur_frm.doc.supplier_name;
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
@ -128,6 +111,7 @@ cur_frm.cscript.make_contact = function() {
|
||||
|
||||
// make purchase order list
|
||||
cur_frm.cscript.make_po_list = function(parent, doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','25%','20%','25%','25%'];
|
||||
lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
|
||||
@ -142,6 +126,7 @@ cur_frm.cscript.make_po_list = function(parent, doc){
|
||||
|
||||
// make purchase receipt list
|
||||
cur_frm.cscript.make_pr_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total'];
|
||||
@ -156,6 +141,7 @@ cur_frm.cscript.make_pr_list = function(parent,doc){
|
||||
|
||||
// make purchase invoice list
|
||||
cur_frm.cscript.make_pi_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
|
||||
lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total'];
|
||||
|
@ -46,10 +46,10 @@
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 4px solid white;
|
||||
box-shadow: 0 0 10px 1px black;
|
||||
-moz-box-shadow: 0 0 10px 1px black;
|
||||
-webkit-box-shadow: 0 0 10px 1px black;
|
||||
-o-box-shadow: 0 0 10px 1px black;
|
||||
box-shadow: 0 0 4px 1px black;
|
||||
-moz-box-shadow: 0 0 4px 1px black;
|
||||
-webkit-box-shadow: 0 0 4px 1px black;
|
||||
-o-box-shadow: 0 0 4px 1px black;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@ -65,14 +65,14 @@
|
||||
/*font-size: 12px;*/
|
||||
padding-top: 10px;
|
||||
text-align: center;
|
||||
text-shadow: 1px 1px 5px #000, 3px 3px 5px #000;
|
||||
text-shadow: 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 2px #000;
|
||||
}
|
||||
|
||||
/* Hover and click effects */
|
||||
.case-border:hover, .circle:hover, .hover-effect {
|
||||
box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
|
||||
-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
|
||||
-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
|
||||
box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
|
||||
-moz-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
|
||||
-webkit-box-shadow: 0 0 2px 0px black, 0 0 4px 1px white !important;
|
||||
-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important;
|
||||
}
|
||||
|
||||
@ -105,10 +105,10 @@
|
||||
margin-top: -74px;
|
||||
margin-right: 10px;
|
||||
border: 2px solid white;
|
||||
box-shadow: 0 0 10px 1px black;
|
||||
-moz-box-shadow: 0 0 10px 1px black;
|
||||
-webkit-box-shadow: 0 0 10px 1px black;
|
||||
-o-box-shadow: 0 0 10px 1px black;
|
||||
box-shadow: 0 0 4px 1px black;
|
||||
-moz-box-shadow: 0 0 4px 1px black;
|
||||
-webkit-box-shadow: 0 0 4px 1px black;
|
||||
-o-box-shadow: 0 0 4px 1px black;
|
||||
}
|
||||
|
||||
.circle-text {
|
||||
|
@ -72,15 +72,6 @@ cur_frm.cscript.make_address = function() {
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
@ -114,17 +105,6 @@ cur_frm.cscript.make_contact = function() {
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.customer = cur_frm.doc.name;
|
||||
ndoc.customer_name = cur_frm.doc.customer_name;
|
||||
if(cur_frm.doc.customer_type == 'Individual') {
|
||||
ndoc.first_name = cur_frm.doc.customer_name;
|
||||
}
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where customer='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
@ -174,6 +154,7 @@ cur_frm.fields_dict['lead_name'].get_query = function(doc,dt,dn){
|
||||
// make quotation list
|
||||
// --------------------
|
||||
cur_frm.cscript.make_qtn_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
@ -191,6 +172,8 @@ cur_frm.cscript.make_qtn_list = function(parent,doc){
|
||||
// make so list
|
||||
// -------------
|
||||
cur_frm.cscript.make_so_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','30%','25%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Sales Order Date','Grand Total'];
|
||||
@ -207,6 +190,8 @@ cur_frm.cscript.make_so_list = function(parent,doc){
|
||||
// make dn list
|
||||
// -------------
|
||||
cur_frm.cscript.make_dn_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Delivery Note Date','Territory','Grand Total'];
|
||||
@ -223,6 +208,8 @@ cur_frm.cscript.make_dn_list = function(parent,doc){
|
||||
// make si list
|
||||
// -------------
|
||||
cur_frm.cscript.make_si_list = function(parent,doc){
|
||||
wn.require('lib/js/legacy/widgets/listing.js');
|
||||
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','20%','15%'];
|
||||
lst.colnames = ['Sr.','Id','Posting Date','Due Date','Debit To','Grand Total'];
|
||||
|
@ -1,14 +1,6 @@
|
||||
// common partner functions
|
||||
// =========================
|
||||
|
||||
/*
|
||||
// make shipping list body
|
||||
// ------------------------
|
||||
cur_frm.cscript.make_sl_body = function(){
|
||||
cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
|
||||
cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
|
||||
}
|
||||
*/
|
||||
|
||||
// make history list body
|
||||
// -----------------------
|
||||
@ -18,35 +10,6 @@ cur_frm.cscript.make_hl_body = function(){
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// set shipping list message
|
||||
// --------------------------
|
||||
cur_frm.cscript.set_sl_msg = function(doc){
|
||||
cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// set history list message
|
||||
// -------------------------
|
||||
cur_frm.cscript.set_hl_msg = function(doc){
|
||||
cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
// make shipping address
|
||||
// -------------
|
||||
cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
|
||||
cur_frm.shipping_html.innerHTML = '';
|
||||
|
||||
var dsn = cur_frm.doc.customer_name;
|
||||
var dsa = cur_frm.doc.address;
|
||||
cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// make history
|
||||
// -------------
|
||||
cur_frm.cscript.make_history = function(doc,dt,dn){
|
||||
@ -157,406 +120,4 @@ if(cur_frm.fields_dict['territory']){
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =======================================================================================================
|
||||
|
||||
// contact list
|
||||
// --------------
|
||||
ContactList = function(parent,dt,dn,dsn){
|
||||
|
||||
var me = this;
|
||||
|
||||
this.dt = dt;
|
||||
this.dn = dn;
|
||||
this.dsn = dsn ? dsn : dn;
|
||||
|
||||
this.wrapper = $a(parent,'div');
|
||||
me.get_list();
|
||||
}
|
||||
|
||||
// add contact
|
||||
// ------------
|
||||
ContactList.prototype.add_contact = function(){
|
||||
var me = this;
|
||||
|
||||
// onload - set default values
|
||||
var cont = LocalDB.create('Contact');
|
||||
|
||||
var c = locals['Contact'][cont];
|
||||
|
||||
if(me.dt == 'Customer') {
|
||||
c.is_customer = 1;
|
||||
c.customer = me.dn;
|
||||
c.customer_name = me.dsn;
|
||||
}
|
||||
else if(me.dt == 'Supplier'){
|
||||
c.is_supplier = 1;
|
||||
c.supplier = me.dn;
|
||||
c.supplier_name = me.dsn;
|
||||
}
|
||||
else if(me.dt == 'Sales Partner'){
|
||||
c.is_sales_partner = 1;
|
||||
c.sales_partner = me.dn;
|
||||
//c.sales_partner_name = me.dsn;
|
||||
}
|
||||
|
||||
loaddoc('Contact',c.name);
|
||||
}
|
||||
|
||||
// get contact list
|
||||
// -----------------
|
||||
ContactList.prototype.get_list = function(){
|
||||
var me = this;
|
||||
|
||||
me.make_list();
|
||||
|
||||
var dt = me.dt.toLowerCase().split(' ').join('_');
|
||||
|
||||
// build query
|
||||
me.lst.get_query = function(){
|
||||
this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
|
||||
|
||||
this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
|
||||
}
|
||||
|
||||
// render list ui
|
||||
me.lst.show_cell = function(cell,ri,ci,d){
|
||||
me.render_list(cell,ri,ci,d);
|
||||
}
|
||||
|
||||
// run query
|
||||
me.lst.run();
|
||||
|
||||
// onrun
|
||||
me.lst.onrun = function(){
|
||||
if(!this.has_data()){
|
||||
this.rec_label.innerHTML = '';
|
||||
|
||||
$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
|
||||
$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
|
||||
|
||||
$dh(this.results);
|
||||
}
|
||||
else{
|
||||
$ds(this.results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make list
|
||||
// -----------
|
||||
ContactList.prototype.make_list = function(){
|
||||
var me = this;
|
||||
|
||||
var l = new Listing();
|
||||
l.colwidths = ['5%','30%','30%','20%','20%'];
|
||||
l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
|
||||
l.page_len = 10;
|
||||
|
||||
me.lst = l;
|
||||
|
||||
l.make(me.wrapper);
|
||||
|
||||
// Add contact button
|
||||
me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
|
||||
}
|
||||
|
||||
// make contact cell
|
||||
// ------------------
|
||||
ContactList.prototype.render_list = function(cell,ri,ci,d){
|
||||
var me = this;
|
||||
|
||||
// name
|
||||
if(ci == 0){
|
||||
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
|
||||
nm.innerHTML = d[ri][3];
|
||||
nm.id = d[ri][0];
|
||||
|
||||
nm.onclick = function(){
|
||||
loaddoc('Contact', this.id);
|
||||
|
||||
// on save callback - refresh list
|
||||
}
|
||||
|
||||
// department and designation
|
||||
var des = d[ri][7] ? d[ri][7] : '';
|
||||
var dep = d[ri][6] ? d[ri][6] : '';
|
||||
|
||||
var sp = $a(cell,'div','comment');
|
||||
sp.innerHTML = des + (dep ? (', ' + dep) : '');
|
||||
}
|
||||
|
||||
// email id, contact no, department, designation
|
||||
// -----------------------------------------------------
|
||||
if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
|
||||
if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
|
||||
|
||||
// actions
|
||||
// --------------------------------------
|
||||
if(ci== 3) me.make_actions(cell,ri,ci,d);
|
||||
}
|
||||
|
||||
// make actions
|
||||
// ---------------
|
||||
ContactList.prototype.make_actions = function(cell,ri,ci,d){
|
||||
var me = this;
|
||||
|
||||
var tab = make_table(cell,1,2,'100%',['40%','60%']);
|
||||
|
||||
// Edit and Delete
|
||||
var t = make_table($td(tab,0,0),1,2);
|
||||
|
||||
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
|
||||
$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
|
||||
|
||||
edit.setAttribute('title','Edit');
|
||||
|
||||
// Below code should be uncommented once customer/venodr invitation process is stable
|
||||
// ===========================================================================
|
||||
/*
|
||||
var del = $a($td(t,0,1),'div','wn-icon ic-trash');
|
||||
$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
|
||||
|
||||
set_custom_tooltip(del, 'Delete');
|
||||
|
||||
// Invite, Enable and Disable - Integrate after gateway logic incorporated
|
||||
|
||||
if(d[ri][9] == 'Yes') {
|
||||
if(d[ri][10] == 'Yes'){
|
||||
var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
|
||||
$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
|
||||
}
|
||||
else{
|
||||
var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
|
||||
$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
|
||||
}
|
||||
}
|
||||
else{
|
||||
var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
|
||||
$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
|
||||
}*/
|
||||
}
|
||||
|
||||
// enable login
|
||||
// ----------------------------------------------------------
|
||||
ContactList.prototype.enable_login = function(id, email_id){
|
||||
var me = this;
|
||||
|
||||
var callback = function(r,rt){
|
||||
me.get_list();
|
||||
|
||||
if(!r.exc) msgprint('Login for contact enabled',1);
|
||||
else errprint(r.exc);
|
||||
}
|
||||
|
||||
var args = {};
|
||||
args.contact = id;
|
||||
args.email = email_id;
|
||||
|
||||
$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
|
||||
}
|
||||
|
||||
// disable login
|
||||
// -------------------------------------------------------------
|
||||
ContactList.prototype.disable_login = function(id, email_id){
|
||||
var me = this;
|
||||
|
||||
var callback = function(r,rt){
|
||||
me.get_list();
|
||||
|
||||
if(!r.exc) msgprint('Login for contact disabled',1);
|
||||
else errprint(r.exc);
|
||||
}
|
||||
|
||||
var args = {};
|
||||
args.contact = id;
|
||||
args.email = email_id;
|
||||
|
||||
$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
|
||||
}
|
||||
|
||||
// delete contact
|
||||
// -----------------
|
||||
ContactList.prototype.delete_contact = function(id,email_id,has_login){
|
||||
var me = this;
|
||||
|
||||
var callback = function(r,rt){
|
||||
me.get_list();
|
||||
|
||||
if(!r.exc) msgprint('Contact deleted successfully');
|
||||
else errprint(r.exc);
|
||||
}
|
||||
|
||||
var args = {};
|
||||
args.contact = id;
|
||||
args.email = email_id;
|
||||
args.has_login = has_login;
|
||||
|
||||
$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
|
||||
}
|
||||
|
||||
// invite user
|
||||
// --------------------------------------------------------
|
||||
ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
|
||||
var me = this;
|
||||
|
||||
if(!email_id){
|
||||
msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
|
||||
}
|
||||
else{
|
||||
var callback = function(r,rt){
|
||||
if(!r.exc) msgprint('Invitation sent');
|
||||
else errprint(r.exc);
|
||||
}
|
||||
|
||||
var args = {
|
||||
'contact' : id,
|
||||
'email' : email_id,
|
||||
'first_name' : first_name ? first_name : '',
|
||||
'last_name' : last_name ? last_name : '',
|
||||
'usert_type' : 'Partner'
|
||||
};
|
||||
|
||||
$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// address list
|
||||
// --------------
|
||||
AddressList = function(parent,dt,dn,dsn,dsa){
|
||||
|
||||
var me = this;
|
||||
|
||||
this.dt = dt;
|
||||
this.dn = dn;
|
||||
this.dsn = dsn ? dsn : dn;
|
||||
this.dsa = dsa ? dsa : '';
|
||||
|
||||
this.wrapper = $a(parent,'div');
|
||||
me.get_addr_list();
|
||||
}
|
||||
|
||||
|
||||
// add contact
|
||||
// ------------
|
||||
AddressList.prototype.add_address = function(){
|
||||
var me = this;
|
||||
|
||||
// onload - set default values
|
||||
var addr = LocalDB.create('Shipping Address');
|
||||
|
||||
var a = locals['Shipping Address'][addr];
|
||||
|
||||
a.customer = me.dn;
|
||||
a.customer_name = me.dsn;
|
||||
a.customer_address = me.dsa;
|
||||
loaddoc('Shipping Address',a.name);
|
||||
}
|
||||
|
||||
|
||||
// get address list
|
||||
// -----------------
|
||||
AddressList.prototype.get_addr_list = function(){
|
||||
var me = this;
|
||||
|
||||
me.make_addr_list();
|
||||
|
||||
var dt = me.dt.toLowerCase().split(' ').join('_');
|
||||
|
||||
// build query
|
||||
me.lst.get_query = function(){
|
||||
this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
|
||||
|
||||
this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
|
||||
}
|
||||
|
||||
// render list ui
|
||||
me.lst.show_cell = function(cell,ri,ci,d){
|
||||
me.render_list(cell,ri,ci,d);
|
||||
}
|
||||
|
||||
// run query
|
||||
me.lst.run();
|
||||
|
||||
// onrun
|
||||
me.lst.onrun = function(){
|
||||
if(!this.has_data()){
|
||||
this.rec_label.innerHTML = '';
|
||||
|
||||
$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
|
||||
$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
|
||||
|
||||
$dh(this.results);
|
||||
}
|
||||
else{
|
||||
$ds(this.results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// make list
|
||||
// -----------
|
||||
AddressList.prototype.make_addr_list = function(){
|
||||
var me = this;
|
||||
|
||||
var l = new Listing();
|
||||
l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
|
||||
l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
|
||||
l.page_len = 10;
|
||||
|
||||
me.lst = l;
|
||||
|
||||
l.make(me.wrapper);
|
||||
|
||||
// Add address button
|
||||
me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// make address cell
|
||||
// ------------------
|
||||
AddressList.prototype.render_list = function(cell,ri,ci,d){
|
||||
var me = this;
|
||||
|
||||
// name
|
||||
if(ci == 0){
|
||||
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
|
||||
nm.innerHTML = d[ri][1];
|
||||
nm.id = d[ri][0];
|
||||
|
||||
nm.onclick = function(){
|
||||
loaddoc('Shipping Address', this.id);
|
||||
}
|
||||
}
|
||||
|
||||
// shipping address, primary address, shipping details
|
||||
// ----------------------------------------------------
|
||||
if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
|
||||
if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
|
||||
if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
|
||||
|
||||
// actions
|
||||
// --------------------------------------
|
||||
if(ci== 4) me.make_actions(cell,ri,ci,d);
|
||||
}
|
||||
|
||||
// make actions
|
||||
// ---------------
|
||||
AddressList.prototype.make_actions = function(cell,ri,ci,d){
|
||||
var me = this;
|
||||
|
||||
var tab = make_table(cell,1,2,'100%',['40%','60%']);
|
||||
|
||||
// Edit and Delete
|
||||
var t = make_table($td(tab,0,0),1,2);
|
||||
|
||||
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
|
||||
$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
|
||||
|
||||
edit.setAttribute('title','Edit');
|
||||
}
|
||||
}
|
@ -51,15 +51,7 @@ cur_frm.cscript.make_address = function() {
|
||||
cur_frm.address_list = new wn.ui.Listing({
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.sales_partner = cur_frm.doc.name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
new_doctype: "Address",
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
@ -84,13 +76,6 @@ cur_frm.cscript.make_contact = function() {
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.sales_partner = cur_frm.doc.name;
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where sales_partner='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
|
@ -17,5 +17,28 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||
|
||||
var route = wn.get_route();
|
||||
if(route[1]=='Supplier') {
|
||||
var supplier = locals.Supplier[route[2]]
|
||||
doc.supplier = supplier.name;
|
||||
doc.supplier_name = supplier.supplier_name;
|
||||
doc.address_type = 'Office';
|
||||
} else if(route[1]=='Customer') {
|
||||
var customer = locals.Customer[route[2]]
|
||||
doc.supplier = customer.name;
|
||||
doc.customer_name = customer.customer_name;
|
||||
doc.address_type = 'Office';
|
||||
} else if(route[1]=='Sales Partner') {
|
||||
var sp = locals['Sales Partner'][route[2]];
|
||||
doc.sales_partner = sp.name;
|
||||
ndoc.address_type = 'Office';
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.hide_dialog = function() {
|
||||
var route = wn.get_route();
|
||||
cur_frm.address_list.run();
|
||||
}
|
||||
|
||||
|
||||
|
@ -18,54 +18,28 @@
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
|
||||
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
|
||||
}
|
||||
|
||||
/*
|
||||
//---------- on refresh ----------------------
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------- Trigger on customer ---------------------
|
||||
cur_frm.cscript.is_customer = function(doc,cdt,cdn){
|
||||
if(!doc.is_customer){
|
||||
doc.customer = doc.customer_name = doc.customer_address = doc.customer_group = '';
|
||||
refresh_many(['customer','customer_name','customer_address','customer_group']);
|
||||
var route = wn.get_route();
|
||||
if(route[1]=='Supplier') {
|
||||
var supplier = locals.Supplier[route[2]]
|
||||
doc.supplier = supplier.name;
|
||||
doc.supplier_name = supplier.supplier_name;
|
||||
} else if(route[1]=='Customer') {
|
||||
var customer = locals.Customer[route[2]];
|
||||
doc.customer = customer.name;
|
||||
doc.customer_name = customer.customer_name;
|
||||
if(customer.customer_type == 'Individual') {
|
||||
doc.first_name = customer.customer_name;
|
||||
}
|
||||
} else if(route[1]=='Sales Partner') {
|
||||
var sp = locals['Sales Partner'][route[2]];
|
||||
doc.sales_partner = sp.name;
|
||||
}
|
||||
}
|
||||
|
||||
//------------- Trigger on supplier -----------------------
|
||||
cur_frm.cscript.is_supplier = function(doc,cdt,cdn){
|
||||
if(!doc.is_supplier){
|
||||
doc.supplier = doc.supplier_name = doc.supplier_address = doc.supplier_type = '';
|
||||
refresh_many(['supplier','supplier_address','supplier_name','supplier_type']);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------- Trigger on sales partner ---------------------
|
||||
cur_frm.cscript.is_sales_partner = function(doc,cdt,cdn){
|
||||
if(!doc.is_sales_partner){
|
||||
doc.sales_partner = doc.sales_partner_address = doc.partner_type = '';
|
||||
refresh_many(['sales_partner','sales_partner_address','partner_type']);
|
||||
}
|
||||
cur_frm.cscript.hide_dialog = function() {
|
||||
var route = wn.get_route();
|
||||
cur_frm.contact_list.run();
|
||||
}
|
||||
|
||||
//----------- Trigger on supplier name ------------------------
|
||||
cur_frm.cscript.supplier = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Supplier','dn':doc.supplier,'nm':'supplier_name','fld':'supplier_address','type':'supplier_type'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
//------------ Trigger on customer name ------------------------
|
||||
cur_frm.cscript.customer = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Customer','dn':doc.customer,'nm':'customer_name','fld':'customer_address','type':'customer_group'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
//------------ Trigger on sales partner ------------------------
|
||||
cur_frm.cscript.sales_partner = function(doc,cdt,cdn){
|
||||
arg = {'dt':'Sales Partner','dn':doc.sales_partner,'nm':'partner_name','fld':'sales_partner_address','type':'partner_type'};
|
||||
get_server_fields('get_address',docstring(arg),'',doc,cdt,cdn,1);
|
||||
}
|
||||
*/
|
||||
|
@ -24,7 +24,11 @@ pscript.onload_calendar = function(wrapper) {
|
||||
if(!erpnext.calendar) {
|
||||
erpnext.calendar = new Calendar();
|
||||
erpnext.calendar.init(wrapper);
|
||||
rename_observers.push(erpnext.calendar);
|
||||
|
||||
var me = this;
|
||||
$(document).bind('rename', function(event, dt, old_name, new_name) {
|
||||
erpnext.calendar.rename_notify(dt, old_name, new_name)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +67,7 @@ Calendar.prototype.init=function (parent) {
|
||||
|
||||
Calendar.prototype.rename_notify = function(dt, old_name, new_name) {
|
||||
// calendar
|
||||
if(dt = 'Event'){
|
||||
if(dt = 'Event'){
|
||||
if(this.events_by_name[old_name]) {
|
||||
delete this.events_by_name[old_name];
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ body {
|
||||
background-color: #{{ doc.background_color }};
|
||||
{% endif %}
|
||||
{% if doc.font %}
|
||||
font-family: {{ doc.font }} !important;
|
||||
font-family: '{{ doc.font }}', Verdana, Sans !important;
|
||||
{% endif %}
|
||||
{% if doc.font_size %}
|
||||
font-size: {{ doc.font_size }} !important;
|
||||
@ -26,6 +26,6 @@ footer a, footer a:visited, footer a:hover {
|
||||
|
||||
{% if doc.heading_font %}
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: {{ doc.heading_font}} !important;
|
||||
font-family: '{{ doc.heading_font}}', Arial, 'Helvetica Neue' !important;
|
||||
}
|
||||
{% endif %}
|
||||
|
@ -5,150 +5,150 @@
|
||||
{
|
||||
'creation': '2012-02-02 09:57:25',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-02-02 10:47:38',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
'modified': '2012-03-20 11:25:05',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1328159294',
|
||||
'_last_update': u'1330594969',
|
||||
'allow_attach': 1,
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Set your background color, font and image (tiled)',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Set your background color, font and image (tiled)',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'max_attachments': 1,
|
||||
'module': 'Website',
|
||||
'module': u'Website',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 9
|
||||
'version': 14
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Style Settings',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
'parent': u'Style Settings',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Style Settings',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'parent': u'Style Settings',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'read': 1,
|
||||
'role': 'Website Manager'
|
||||
'role': u'Website Manager'
|
||||
},
|
||||
|
||||
# DocType, Style Settings
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Style Settings'
|
||||
'name': u'Style Settings'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Solid background color (default light gray)',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'background_color',
|
||||
'fieldtype': 'Data',
|
||||
'label': 'Background Color',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Solid background color (default light gray)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'background_color',
|
||||
'fieldtype': u'Data',
|
||||
'label': u'Background Color',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'If image is selected, color will be ignored (attach first)',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'background_image',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Background Image',
|
||||
'options': 'attach_files:',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'If image is selected, color will be ignored (attach first)',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'background_image',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Background Image',
|
||||
'options': u'attach_files:',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'font',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Font',
|
||||
'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'font',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Font',
|
||||
'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nPontano Sans\nDroid Sans\nGill Sans',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'font_size',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Font Size',
|
||||
'options': '\n12px\n13px\n14px',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'font_size',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Font Size',
|
||||
'options': u'\n12px\n13px\n14px',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'heading_font',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Heaing Font',
|
||||
'options': '\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'heading_font',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Heading Font',
|
||||
'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nPontano Sans\nDroid Sans\nGill Sans',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select a white footer foreground color if you have a dark background',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'footer_font_color',
|
||||
'fieldtype': 'Select',
|
||||
'label': 'Footer Font Color',
|
||||
'options': '\nwhite',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Select a white footer foreground color if you have a dark background',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'footer_font_color',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Footer Font Color',
|
||||
'options': u'\nwhite',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Auto generated',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'custom_css',
|
||||
'fieldtype': 'Code',
|
||||
'label': 'Custom CSS',
|
||||
'colour': u'White:FFF',
|
||||
'description': u'Auto generated',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'custom_css',
|
||||
'fieldtype': u'Code',
|
||||
'label': u'Custom CSS',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'file_list',
|
||||
'fieldtype': 'Text',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'file_list',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 1,
|
||||
'label': 'File List',
|
||||
'label': u'File List',
|
||||
'no_copy': 1,
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
|
184
js/all-app.js
184
js/all-app.js
@ -185,7 +185,7 @@ wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/user.js
|
||||
*/
|
||||
@ -232,7 +232,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.set_route=function(route){window.location.hash=route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
|
||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
|
||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
|
||||
/*
|
||||
@ -281,7 +281,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype,me.new_doc_onload,true,me.new_doc_onsave);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
|
||||
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
|
||||
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')}
|
||||
@ -407,7 +407,8 @@ if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
|
||||
/*
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})}}
|
||||
/*
|
||||
* lib/js/wn/views/reportview.js
|
||||
@ -961,100 +962,6 @@ else if(d[0]=='Text'){c1.innerHTML=d[1];c2.style.overflow='auto';this.widgets[d[
|
||||
else if(d[0]=='Button'){c2.style.height='32px';var b=$btn(c2,d[1],function(btn){if(btn._onclick)btn._onclick(me)},null,null,1);b.dialog=me;if(!this.first_button){$(b).addClass('btn-info');this.first_button=true;}
|
||||
if(d[2]){b._onclick=d[2];}
|
||||
this.widgets[d[1]]=b;}}
|
||||
/*
|
||||
* lib/js/legacy/widgets/listing.js
|
||||
*/
|
||||
list_opts={cell_style:{padding:'3px 2px'},alt_cell_style:{},head_style:{height:'20px',overflow:'hidden',verticalAlign:'middle',fontWeight:'bold',padding:'1px',fontSize:'13px'},head_main_style:{padding:'0px'},hide_export:1,hide_print:1,hide_refresh:0,hide_rec_label:0,show_calc:1,show_empty_tab:0,no_border:1,append_records:1,table_width:null};function Listing(head_text,no_index,no_loading){this.start=0;this.page_len=20;this.filters_per_line=7;this.cell_idx=0;this.head_text=head_text?head_text:'Result';this.keyword='records';this.no_index=no_index;this.underline=1;this.no_rec_message='No Result';this.show_cell=null;this.show_result=null;this.colnames=null;this.colwidths=null;this.coltypes=null;this.coloptions=null;this.filters={};this.sort_list={};this.sort_order_dict={};this.sort_heads={};this.is_std_query=false;this.server_call=null;this.no_loading=no_loading;this.opts=copy_dict(list_opts);}
|
||||
Listing.prototype.make=function(parent){var me=this;this.wrapper=parent;this.filter_wrapper=$a(parent,'div','srs_filter_wrapper');this.filter_area=$a(this.filter_wrapper,'div','srs_filter_area');$dh(this.filter_wrapper);this.btn_area=$a(parent,'div','',{margin:'8px 0px'});this.body_area=$a(parent,'div','srs_body_area');if(!this.opts.hide_rec_label)
|
||||
this.rec_label=$a(this.body_area,'div','',{margin:'4px 0px',color:'#888'});this.results=$a($a(this.body_area,'div','srs_results_area'),'div');this.fetching_area=$a(this.body_area,'div','',{height:'120px',background:'url("lib/images/ui/square_loading.gif") center no-repeat',display:'none'});this.show_no_records=$a(this.body_area,'div','',{margin:'200px 0px',textAlign:'center',fontSize:'14px',color:'#888',display:'none'});this.show_no_records.innerHTML='No Result';if(this.opts.show_empty_tab)
|
||||
this.make_result_tab();this.bottom_div=$a(this.body_area,'div','',{paddingTop:'8px'});this.make_toolbar();}
|
||||
Listing.prototype.make_toolbar=function(){var me=this;this.buttons={};var make_btn=function(label,icon,onclick,bold){var btn=$btn(me.btn_area,label,onclick,{marginRight:'4px'});if(bold)$y(btn,{fontWeight:'bold'});me.buttons[label]=btn;}
|
||||
if(!this.opts.hide_refresh){make_btn('Refresh','ui-icon-refresh',function(btn){me.start=0;me.run();},1);}
|
||||
if(this.opts.show_new){make_btn('New ','ui-icon-document',function(){new_doc(me.dt);},1);}
|
||||
if(this.opts.show_report){make_btn('Report Builder','ui-icon-clipboard',function(){loadreport(me.dt,null,null,null,1);},0);}
|
||||
if(!this.opts.hide_export){make_btn('Export','ui-icon-circle-arrow-e',function(){me.do_export();});}
|
||||
if(!this.opts.hide_print){make_btn('Print','ui-icon-print',function(){me.do_print();});}
|
||||
if(this.opts.show_calc){make_btn('Calc','ui-icon-calculator',function(){me.do_calc();});$dh(me.buttons['Calc'])}
|
||||
this.loading_img=$a(this.btn_area,'img','',{display:'none',marginBottom:'-2px'});this.loading_img.src='lib/images/ui/button-load.gif';if(!keys(this.buttons).length)
|
||||
$dh(this.btn_area);}
|
||||
Listing.prototype.do_print=function(){this.build_query();if(!this.query){alert('No Query!');return;}
|
||||
args={query:this.query,title:this.head_text,colnames:this.colnames,colwidths:this.colwidths,coltypes:this.coltypes,has_index:(this.no_index?0:1),has_headings:1,check_limit:1,is_simple:1}
|
||||
wn.require('lib/js/legacy/widgets/print_query.js');_p.print_query=new _p.PrintQuery();_p.print_query.show_dialog(args);}
|
||||
Listing.prototype.do_calc=function(){show_calc(this.result_tab,this.colnames,this.coltypes,0)}
|
||||
Listing.prototype.add_filter=function(label,ftype,options,tname,fname,cond){if(!this.filter_area){alert('[Listing] make() must be called before add_filter');}
|
||||
var me=this;if(!this.filter_set){var h=$a(this.filter_area,'div','',{fontSize:'14px',fontWeight:'bold',marginBottom:'4px'});h.innerHTML='Filter your search';this.filter_area.div=$a(this.filter_area,'div');this.perm=[[1,1],]
|
||||
this.filters={};}
|
||||
$ds(this.filter_wrapper);if((!this.inp_tab)||(this.cell_idx==this.filters_per_line)){this.inp_tab=$a(this.filter_area.div,'table','',{width:'100%',tableLayout:'fixed'});this.inp_tab.insertRow(0);for(var i=0;i<this.filters_per_line;i++){this.inp_tab.rows[0].insertCell(i);}
|
||||
this.cell_idx=0;}
|
||||
var c=this.inp_tab.rows[0].cells[this.cell_idx];this.cell_idx++;$y(c,{width:cint(100/this.filters_per_line)+'%',textAlign:'left',verticalAlign:'top'});var d1=$a(c,'div','',{fontSize:'11px',marginBottom:'2px'});d1.innerHTML=label;if(ftype=='Link')d1.innerHTML+=' <img src="lib/images/icons/link.png" style="margin-bottom:-5px" title="Link">';var d2=$a(c,'div');if(in_list(['Text','Small Text','Code','Text Editor','Read Only'],ftype))
|
||||
ftype='Data';if(ftype=='Select'&&!in_list(options.split('\n'),''))options='\n'+options
|
||||
var inp=make_field({fieldtype:ftype,'label':label,'options':options,no_buttons:1},'',d2,this,0,1);inp.not_in_form=1;inp.report=this;inp.df.single_select=1;inp.parent_cell=c;inp.parent_tab=this.input_tab;$y(inp.wrapper,{width:'95%'});inp.refresh();inp.tn=tname;inp.fn=fname;inp.condition=ftype=='Data'?'like':cond;var me=this;inp.onchange=function(){me.start=0;}
|
||||
this.filters[label]=inp;this.filter_set=1;}
|
||||
Listing.prototype.remove_filter=function(label){var inp=this.filters[label];inp.parent_tab.rows[0].deleteCell(inp.parent_cell.cellIndex);delete this.filters[label];}
|
||||
Listing.prototype.remove_all_filters=function(){for(var k in this.filters)this.remove_filter(k);$dh(this.filter_wrapper);}
|
||||
Listing.prototype.add_sort=function(ci,fname){this.sort_list[ci]=fname;}
|
||||
Listing.prototype.has_data=function(){return this.n_records;}
|
||||
Listing.prototype.set_default_sort=function(fname,sort_order){this.sort_order=sort_order;this.sort_order_dict[fname]=sort_order;this.sort_by=fname;if(this.sort_heads[fname])
|
||||
this.sort_heads[fname].set_sorting_as(sort_order);}
|
||||
Listing.prototype.set_sort=function(cell,ci,fname){var me=this;$y(cell.sort_cell,{width:'18px'});cell.sort_img=$a(cell.sort_cell,'img');cell.fname=fname;$dh(cell.sort_img);cell.set_sort_img=function(order){var t='images/icons/sort_desc.gif';if(order=='ASC'){t='images/icons/sort_asc.gif';}
|
||||
this.sort_img.src=t;}
|
||||
cell.set_sorting_as=function(order){me.sort_order=order;me.sort_by=this.fname
|
||||
me.sort_order_dict[this.fname]=order;this.set_sort_img(order)
|
||||
if(me.cur_sort){$y(me.cur_sort,{backgroundColor:"#FFF"});$dh(me.cur_sort.sort_img);}
|
||||
me.cur_sort=this;$y(this,{backgroundColor:"#DDF"});$di(this.sort_img);}
|
||||
$y(cell.label_cell,{color:'#44A',cursor:'pointer'});cell.set_sort_img(me.sort_order_dict[fname]?me.sort_order_dict[fname]:'ASC');cell.onmouseover=function(){$di(this.sort_img);}
|
||||
cell.onmouseout=function(){if(this!=me.cur_sort)
|
||||
$dh(this.sort_img);}
|
||||
cell.onclick=function(){this.set_sorting_as((me.sort_order_dict[fname]=='ASC')?'DESC':'ASC');me.run();}
|
||||
this.sort_heads[fname]=cell;}
|
||||
Listing.prototype.do_export=function(){this.build_query();var me=this;me.cn=[];if(this.no_index)
|
||||
me.cn=this.colnames;else{for(var i=1;i<this.colnames.length;i++)
|
||||
me.cn.push(this.colnames[i]);}
|
||||
var q=export_query(this.query,function(query){export_csv(query,me.head_text,null,1,null,me.cn);});}
|
||||
Listing.prototype.build_query=function(){if(this.get_query)this.get_query(this);if(!this.query){alert('No Query!');return;}
|
||||
if(!this.prefix)this.prefix='tab';var cond=[];for(var i in this.filters){var f=this.filters[i];var val=f.get_value();var c=f.condition;if(!c)c='=';if(val&&c.toLowerCase()=='like')val+='%';if(f.tn&&val&&!in_list(['All','Select...',''],val))
|
||||
cond.push(repl(' AND `%(prefix)s%(dt)s`.%(fn)s %(condition)s "%(val)s"',{prefix:this.prefix,dt:f.tn,fn:f.fn,condition:c,val:val}));}
|
||||
if(cond){this.query+=NEWLINE+cond.join(NEWLINE)
|
||||
if(this.query_max)
|
||||
this.query_max+=NEWLINE+cond.join(NEWLINE)}
|
||||
if(this.group_by)
|
||||
this.query+=' '+this.group_by+' ';if(this.sort_by&&this.sort_order){this.query+=NEWLINE+' ORDER BY `'+this.sort_by+'` '+this.sort_order;}
|
||||
if(this.show_query)msgprint(this.query);}
|
||||
Listing.prototype.set_rec_label=function(total,cur_page_len){if(this.opts.hide_rec_label)
|
||||
return;else if(total==-1)
|
||||
this.rec_label.innerHTML='Fetching...'
|
||||
else if(total>0)
|
||||
this.rec_label.innerHTML=repl('Total %(total)s %(keyword)s. Showing %(start)s to %(end)s',{total:total,start:cint(this.start)+1,end:cint(this.start)+cint(cur_page_len),keyword:this.keyword});else if(total==null)
|
||||
this.rec_label.innerHTML=''
|
||||
else if(total==0)
|
||||
this.rec_label.innerHTML=this.no_rec_message;}
|
||||
Listing.prototype.run=function(run_callback){this.build_query();var q=this.query;var me=this;if(this.max_len&&this.start>=this.max_len)this.start-=this.page_len;q+=' LIMIT '+this.start+','+this.page_len;var call_back=function(r,rt){$dh(me.loading_img);me.max_len=r.n_values;if(r.values&&r.values.length){me.n_records=r.values.length;var nc=r.values[0].length;if(me.colwidths)nc=me.colwidths.length-(me.no_index?0:1);if(me.opts.append_records&&me.start!=0){me.append_rows(r.values.length);}else{me.clear_tab();if(!me.show_empty_tab){me.remove_result_tab();me.make_result_tab(r.values.length);}}
|
||||
me.refresh(r.values.length,nc,r.values,r.n_values);me.total_records=r.n_values;me.set_rec_label(r.n_values,r.values.length);}else{me.n_records=0;me.set_rec_label(0);me.clear_tab();if(!me.opts.append_records){if(me.show_empty_tab){me.clear_tab();}else{me.remove_result_tab();me.make_result_tab(0);if(me.opts.show_no_records_label){$ds(me.show_no_records);}}}}
|
||||
$ds(me.results);if(run_callback)run_callback();if(me.onrun)me.onrun();}
|
||||
$dh(me.show_no_records);this.set_rec_label(-1);$di(this.loading_img);if(this.server_call){this.server_call(this,call_back);}else{args={query_max:(this.query_max?this.query_max:'')}
|
||||
if(this.is_std_query)args.query=q;else args.simple_query=q;if(this.opts.formatted)args.formatted=1;$c('webnotes.widgets.query_builder.runquery',args,call_back,null,this.no_loading);}}
|
||||
Listing.prototype.remove_result_tab=function(){if(!this.result_tab)return;this.result_tab.parentNode.removeChild(this.result_tab);delete this.result_tab;}
|
||||
Listing.prototype.reset_tab=function(){this.remove_result_tab();this.make_result_tab();}
|
||||
Listing.prototype.make_result_tab=function(nr){if(this.result_tab)return;if(!this.colwidths)alert("Listing: Must specify column widths");var has_headrow=this.colnames?1:0;if(nr==null)nr=this.page_len;nr+=has_headrow;var nc=this.colwidths.length;var t=make_table(this.results,nr,nc,(this.opts.table_width?this.opts.table_width:'100%'),this.colwidths,{padding:'0px'});t.className='srs_result_tab';this.result_tab=t;$y(t,{borderCollapse:'collapse'});if(this.opts.table_width){$y(this.results,{overflowX:'auto'});$y(t,{tableLayout:'fixed'});}
|
||||
if(has_headrow){this.make_headings(t,nr,nc);if(this.sort_by&&this.sort_heads[this.sort_by]){this.sort_heads[this.sort_by].set_sorting_as(this.sort_order);}}
|
||||
this.set_table_style();if(this.opts.no_border==1){$y(t,{border:'0px'});}
|
||||
this.result_tab=t;}
|
||||
Listing.prototype.set_table_style=function(){var t=this.result_tab;for(var ri=(this.colnames?1:0);ri<t.rows.length;ri++){for(var ci=0;ci<t.rows[ri].cells.length;ci++){if(this.opts.cell_style)$y($td(t,ri,ci),this.opts.cell_style);if(this.opts.alt_cell_style&&(ri%2))$y($td(t,ri,ci),this.opts.alt_cell_style);if(this.opts.show_empty_tab&&!$td(t,ri,ci).innerHTML)$td(t,ri,ci).innerHTML=' ';}}}
|
||||
Listing.prototype.append_rows=function(nr){for(var i=0;i<nr;i++){append_row(this.result_tab);}
|
||||
this.set_table_style();}
|
||||
Listing.prototype.clear_tab=function(){$dh(this.results);if(this.result_tab){var nr=this.result_tab.rows.length;var nc=this.result_tab.rows[0].cells.length;for(var ri=(this.colnames?1:0);ri<nr;ri++)
|
||||
for(var ci=0;ci<nc;ci++)
|
||||
$td(this.result_tab,ri,ci).innerHTML=(this.opts.show_empty_tab?' ':'');}}
|
||||
Listing.prototype.clear=function(){this.rec_label.innerHTML='';this.clear_tab();}
|
||||
Listing.prototype.refresh_calc=function(){if(!this.opts.show_calc)return;if(has_common(this.coltypes,['Currency','Int','Float'])){$di(this.buttons['Calc']);}else{$dh(this.buttons['Calc']);}}
|
||||
Listing.prototype.refresh=function(nr,nc,d,n_values){this.refresh_more_button(nr,n_values);this.refresh_calc();if(this.show_result)
|
||||
this.show_result();else{if(nr){var start=this.result_tab.rows.length-nr;for(var ri=start;ri<start+nr;ri++){var c0=$td(this.result_tab,ri,0);if(!this.no_index){c0.innerHTML=cint(this.start)+cint(ri-start)+1;}
|
||||
for(var ci=0;ci<nc;ci++){var c=$td(this.result_tab,ri,ci+(this.no_index?0:1));if(c){c.innerHTML='';if(this.show_cell)this.show_cell(c,ri-start,ci,d);else this.std_cell(c,ri-start,ci,d);}}}}}}
|
||||
Listing.prototype.refresh_more_button=function(nr,n_values){var me=this;if(this.more_btn){$dh(this.more_btn);}
|
||||
if((this.start+nr)==this.max_len||(!this.max_len&&nr<this.page_len)){}else if(nr){if(!this.more_btn){$y(this.bottom_div,{margin:'8px 0px 16px 0px',textAlign:'center'});this.more_btn=$btn(this.bottom_div,'Show more results...',function(){me.start=me.start+me.page_len;me.more_btn.set_working();me.run(function(){me.more_btn.done_working();});},{fontSize:'14px'},0,1);$y(this.more_btn.loading_img,{marginBottom:'0px'});}
|
||||
$di(this.more_btn);}}
|
||||
Listing.prototype.make_headings=function(t,nr,nc){for(var ci=0;ci<nc;ci++){var tmp=make_table($td(t,0,ci),1,2,'100%',['','0px'],this.opts.head_style);$y(tmp,{tableLayout:'fixed',borderCollapse:'collapse'});$y($td(t,0,ci),this.opts.head_main_style);$td(t,0,ci).sort_cell=$td(tmp,0,1);$td(t,0,ci).label_cell=$td(tmp,0,0);$td(tmp,0,1).style.padding='0px';$td(tmp,0,0).innerHTML=this.colnames[ci]?this.colnames[ci]:' ';if(this.sort_list[ci])this.set_sort($td(t,0,ci),ci,this.sort_list[ci]);var div=$a($td(t,0,ci),'div');$td(t,0,ci).style.borderBottom='1px solid #CCC';if(this.coltypes&&this.coltypes[ci]&&in_list(['Currency','Float','Int'],this.coltypes[ci]))$y($td(t,0,ci).label_cell,{textAlign:'right'})}}
|
||||
Listing.prototype.std_cell=function(cell,ri,ci,d){var has_headrow=this.colnames?1:0;cell.div=$a(cell,'div');$s(cell.div,d[ri][ci],this.coltypes?this.coltypes[ci+(this.no_index?0:1)]:null,this.coloptions?this.coloptions[ci+(this.no_index?0:1)]:null);}
|
||||
/*
|
||||
* lib/js/legacy/widgets/layout.js
|
||||
*/
|
||||
@ -1238,12 +1145,13 @@ err_console.onshow=function(){err_console.rows['Error List'].innerHTML='<div sty
|
||||
* lib/js/legacy/webpage/loaders.js
|
||||
*/
|
||||
function loadreport(dt,rep_name,onload){if(rep_name)
|
||||
wn.set_route('Report/'+encodeURIComponent(dt)+'/'+encodeURIComponent(rep_name));else
|
||||
wn.set_route('Report/'+encodeURIComponent(dt));}
|
||||
function loaddoc(doctype,name,onload){doctype=get_label_doctype(doctype);wn.set_route(['Form',encodeURIComponent(doctype),encodeURIComponent(name)].join('/'));}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.set_route(['Form',encodeURIComponent(doctype),encodeURIComponent('New '+doctype)].join('/'));}
|
||||
wn.set_route('Report',dt,rep_name);else
|
||||
wn.set_route('Report',dt);}
|
||||
function loaddoc(doctype,name,onload){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){console.log(1)
|
||||
_f.edit_record(doctype,name);}else{wn.set_route('Form',doctype,name);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,'New '+doctype);}else{wn.set_route('Form',doctype,'New '+doctype);}})}
|
||||
var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
|
||||
function loaddocbrowser(dt,label,fields){wn.set_route('List/'+encodeURICompontent(dt));}
|
||||
function loaddocbrowser(dt){wn.set_route('List',dt);}
|
||||
/*
|
||||
* lib/js/legacy/webpage/uploader.js
|
||||
*/
|
||||
@ -1319,14 +1227,11 @@ LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);for(var i=0;i<
|
||||
d.name=LocalDB.get_localname(d.doctype);LocalDB.add(d.doctype,d.name);locals[d.doctype][d.name]=d;if(d.doctype=='DocType'){fields_list[d.name]=[];}else if(d.doctype=='DocField'){if(!d.parent){alert('Error: No parent specified for field "'+d.label+'"');}
|
||||
if(!fields_list[d.parent])fields_list[d.parent]=[];fields_list[d.parent][fields_list[d.parent].length]=d;if(!fields[d.parent])
|
||||
fields[d.parent]={};if(d.fieldname){fields[d.parent][d.fieldname]=d;}else if(d.label){fields[d.parent][d.label]=d;}}
|
||||
if(d.localname)
|
||||
notify_rename_observers(d.doctype,d.localname,d.name);}}
|
||||
if(d.localname){wn.model.new_names[d.localname]=d.name;$(document).trigger('rename',[d.doctype,d.localname,d.name]);delete locals[d.doctype][d.localname];}}}
|
||||
local_name_idx={};LocalDB.get_localname=function(doctype){if(!local_name_idx[doctype])local_name_idx[doctype]=1;var n='New '+get_doctype_label(doctype)+' '+local_name_idx[doctype];local_name_idx[doctype]++;return n;}
|
||||
LocalDB.set_default_values=function(doc){var doctype=doc.doctype;var docfields=fields_list[doctype];if(!docfields){return;}
|
||||
var fields_to_refresh=[];for(var fid=0;fid<docfields.length;fid++){var f=docfields[fid];if(!in_list(no_value_fields,f.fieldtype)&&doc[f.fieldname]==null){var v=LocalDB.get_default_value(f.fieldname,f.fieldtype,f['default']);if(v){doc[f.fieldname]=v;fields_to_refresh.push(f.fieldname);}}}
|
||||
return fields_to_refresh;}
|
||||
LocalDB.is_doc_loaded=function(dt,dn){var exists=false;if(locals[dt]&&locals[dt][dn])exists=true;if(exists&&dt=='DocType'&&!locals[dt][dn].__islocal&&!frms[dt])
|
||||
exists=false;return exists;}
|
||||
function check_perm_match(p,dt,dn){if(!dn)return true;var out=false;if(p.match){if(user_defaults[p.match]){for(var i=0;i<user_defaults[p.match].length;i++){if(user_defaults[p.match][i]==locals[dt][dn][p.match]){return true;}}
|
||||
return false;}else if(!locals[dt][dn][p.match]){return true;}else{return false;}}else{return true;}}
|
||||
function get_perm(doctype,dn,ignore_submit){var perm=[[0,0],];if(in_list(user_roles,'Administrator'))perm[0][READ]=1;var plist=getchildren('DocPerm',doctype,'permissions','DocType');for(var pidx in plist){var p=plist[pidx];var pl=cint(p.permlevel?p.permlevel:0);if(in_list(user_roles,p.role)){if(check_perm_match(p,doctype,dn)){if(!perm[pl])perm[pl]=[];if(!perm[pl][READ]){if(cint(p.read))perm[pl][READ]=1;else perm[pl][READ]=0;}
|
||||
@ -1355,9 +1260,6 @@ var df=get_field(dt,key);if(df&&((!from_amend&&cint(df.no_copy)==1)||in_list(Loc
|
||||
return locals[dt][newdoc];}
|
||||
function make_doclist(dt,dn,deleted){var dl=[];dl[0]=locals[dt][dn];for(var ndt in locals){if(locals[ndt]){for(var ndn in locals[ndt]){var doc=locals[ndt][ndn];if(doc&&doc.parenttype==dt&&(doc.parent==dn||(deleted&&doc.__oldparent==dn))){dl[dl.length]=doc;}}}}
|
||||
return dl;}
|
||||
var rename_observers=[];function notify_rename_observers(dt,old_name,new_name){try{delete locals[dt][old_name];}catch(e){alert("[rename_from_local] No Document for: "+old_name);}
|
||||
for(var i=0;i<rename_observers.length;i++){if(rename_observers[i])
|
||||
rename_observers[i].rename_notify(dt,old_name,new_name);}}
|
||||
var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_doclist('DocType',dt);if(!local_dt[dt])local_dt[dt]={};if(!local_dt[dt][dn])local_dt[dt][dn]={};for(var i=0;i<dl.length;i++){var d=dl[i];if(d.doctype=='DocField'){var key=d.fieldname?d.fieldname:d.label;local_dt[dt][dn][key]=copy_dict(d);}}}
|
||||
Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(fields[dt])var d=fields[dt][fn];if(d)return d;}
|
||||
return{};}
|
||||
@ -1385,7 +1287,6 @@ function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
return obj;}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
|
||||
all_clear=tmp;}}
|
||||
var f=frms[dt];if(f&&!all_clear){if(f)f.savingflag=false;return'Error';}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
@ -1422,7 +1323,7 @@ wn.ui.toolbar.RecentDocs=Class.extend({init:function(){$('.navbar .nav:first').a
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" \
|
||||
onclick="return false;">Recent<b class="caret"></b></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-recent"></ul>\
|
||||
</li>');this.setup();this.bind_events();},bind_events:function(){rename_observers.push(this);},rename_notify:function(dt,old,name){this.remove(dt,old);this.add(dt,name,1);},add:function(dt,dn,on_top){if(this.istable(dt))return;this.remove(dt,dn);var html=repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
</li>');this.setup();this.bind_events();},bind_events:function(){var me=this;$(document).bind('rename',function(event,dt,old_name,new_name){me.rename_notify(dt,old_name,new_name)});},rename_notify:function(dt,old,name){this.remove(dt,old);this.add(dt,name,1);},add:function(dt,dn,on_top){if(this.istable(dt))return;this.remove(dt,dn);var html=repl('<li data-docref="%(dt)s/%(dn)s">\
|
||||
<a href="#Form/%(dt)s/%(dn)s">\
|
||||
%(dn)s <span style="font-size: 10px">(%(dt)s)</span>\
|
||||
</a></li>',{dt:dt,dn:dn});if(on_top){$('#toolbar-recent').prepend(html);}else{$('#toolbar-recent').append(html);}},istable:function(dt){return locals.DocType[dt]&&locals.DocType[dt].istable||false;},remove:function(dt,dn){$(repl('#toolbar-recent li[data-docref="%(dt)s/%(dn)s"]',{dt:dt,dn:dn})).remove();},setup:function(){try{var rlist=JSON.parse(profile.recent);}
|
||||
@ -1685,7 +1586,7 @@ if(frm){f.frm=frm;if(parent)
|
||||
f.layout_cell=parent.parentNode;}
|
||||
if(f.init)f.init();f.make_body();return f;}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form_container.js
|
||||
* lib/js/legacy/widgets/form/form_dialog.js
|
||||
*/
|
||||
_f.frm_dialog=null;_f.calling_doc_stack=[];_f.temp_access={};_f.FrmDialog=function(){var me=this;this.last_displayed=null;var d=new Dialog(640,null,'Edit Row');this.body=$a(d.body,'div','dialog_frm');$y(d.body,{backgroundColor:'#EEE'});d.done_btn_area=$a(d.body,'div','',{margin:'8px'});me.on_complete=function(){if(me.table_form){me.dialog.hide();}else{var callback=function(r){var dn=cur_frm.docname;if(!r.exc){me.dialog.hide();}
|
||||
if(me.on_save_callback)
|
||||
@ -1693,15 +1594,19 @@ me.on_save_callback(dn);}
|
||||
cur_frm.save('Save',callback);}}
|
||||
d.onshow=function(){d.done_btn_area.innerHTML='';d.done_btn=$btn(d.done_btn_area,'Save',null,null,'green');d.done_btn.onclick=function(){me.on_complete()};if(me.table_form){d.set_title("Editing Row #"+(_f.cur_grid_ridx+1));d.done_btn.innerHTML='Done Editing';}else{d.set_title(cur_frm.doctype==cur_frm.doctype?(cur_frm.doctype):(cur_frm.doctype+': '+cur_frm.docname));d.done_btn.innerHTML='Save';}}
|
||||
d.onhide=function(){if(_f.cur_grid)
|
||||
_f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(wn.container.page.frm){cur_frm=wn.container.page.frm;}}
|
||||
_f.cur_grid.refresh_row(_f.cur_grid_ridx,me.dn);if(wn.container.page.frm){cur_frm=wn.container.page.frm;}
|
||||
if(me.cur_frm.cscript.hide_dialog){me.cur_frm.cscript.hide_dialog();}}
|
||||
this.dialog=d;}
|
||||
_f.edit_record=function(dt,dn){if(!_f.frm_dialog){_f.frm_dialog=new _f.FrmDialog();}
|
||||
var d=_f.frm_dialog;wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!_f.frms[dt]){_f.frms[dt]=new _f.Frm(dt,d.body);}
|
||||
var f=_f.frms[dt];if(f.meta.istable){f.parent_doctype=cur_frm.doctype;f.parent_docname=cur_frm.docname;}
|
||||
d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);d.dialog.show();})})}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form_header.js
|
||||
*/
|
||||
_f.FrmHeader=function(parent,frm){var me=this;this.wrapper=$a(parent,'div');if(frm.meta.in_dialog)$y(this.wrapper,{marginLeft:'8px',marginRight:'8px'});this.page_head=new PageHeader(this.wrapper);this.dt_area=$a(this.page_head.main_head,'h1','',{marginRight:'8px',display:'inline'})
|
||||
var div=$a(null,'div','',{marginBottom:'4px'});this.page_head.lhs.insertBefore(div,this.page_head.sub_head);this.dn_area=$a(div,'span','',{fontSize:'14px',fontWeight:'normal',marginRight:'8px',padding:'2px'})
|
||||
this.status_area=$a(div,'span','',{marginRight:'8px',marginBottom:'2px',cursor:'pointer',textShadow:'none'})
|
||||
this.timestamp_area=$a($a(div,'div','',{marginTop:'3px'}),'span','field_description',{fontSize:'11px'});}
|
||||
this.status_area=$a(div,'span','',{marginRight:'8px',marginBottom:'2px',cursor:'pointer',textShadow:'none'})}
|
||||
_f.FrmHeader.prototype.show=function(){$ds(this.wrapper);}
|
||||
_f.FrmHeader.prototype.hide=function(){$dh(this.wrapper);}
|
||||
_f.FrmHeader.prototype.refresh=function(){var me=this;var p=cur_frm.get_doc_perms();this.page_head.clear_toolbar();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable)
|
||||
@ -1716,8 +1621,6 @@ this.page_head.add_button('Amend',function(){cur_frm.amend_doc()},0,'icon-pencil
|
||||
_f.FrmHeader.prototype.show_toolbar=function(){$ds(this.wrapper);this.refresh();}
|
||||
_f.FrmHeader.prototype.hide_toolbar=function(){$dh(this.wrapper);}
|
||||
_f.FrmHeader.prototype.refresh_toolbar=function(){var m=cur_frm.meta;if(m.hide_heading||cur_frm.in_dialog){this.hide();}else{this.show();if(m.hide_toolbar){this.hide_toolbar();}else{this.show_toolbar();}}}
|
||||
_f.FrmHeader.prototype.get_timestamp=function(doc){var scrub_date=function(d){if(d)t=d.split(' ');else return'';return dateutil.str_to_user(t[0])+' '+t[1];}
|
||||
return repl("Created: %(c_by)s %(c_on)s %(m_by)s %(m_on)s",{c_by:doc.owner,c_on:scrub_date(doc.creation?doc.creation:''),m_by:doc.modified_by?(' | Modified: '+doc.modified_by):'',m_on:doc.modified?('on '+scrub_date(doc.modified)):''});}
|
||||
_f.FrmHeader.prototype.get_status_tags=function(doc,f){var make_tag=function(label,col){var s=$a(null,'span','',{padding:'2px',backgroundColor:col,color:'#FFF',fontWeight:'bold',marginLeft:(f.meta.issingle?'0px':'8px'),fontSize:'11px'});$(s).css('-moz-border-radius','3px').css('-webkit-border-radius','3px')
|
||||
s.innerHTML=label;return s;}
|
||||
var sp1=null;var sp2=null;if(doc.__islocal){label='Unsaved Draft';col='#F81';}else if(cint(doc.__unsaved)){label='Not Saved';col='#F81';if(doc.docstatus==1&&this.update_btn)$ds(this.update_btn);}else if(cint(doc.docstatus)==0){label='Saved';col='#0A1';if(f.get_doc_perms()[SUBMIT]){sp2=make_tag('To Be Submitted','#888');}}else if(cint(doc.docstatus)==1){label='Submitted';col='#44F';}else if(cint(doc.docstatus)==2){label='Cancelled';col='#F44';}
|
||||
@ -1725,26 +1628,23 @@ sp1=make_tag(label,col);this.set_in_recent(doc,col);return[sp1,sp2];}
|
||||
_f.FrmHeader.prototype.set_in_recent=function(doc,col){var tn=$i('rec_'+doc.doctype+'-'+doc.name);if(tn)
|
||||
$y(tn,{backgroundColor:col});}
|
||||
_f.FrmHeader.prototype.set_save_submit_color=function(doc){var save_btn=this.page_head.buttons['Save'];var submit_btn=this.page_head.buttons['Submit'];if(cint(doc.docstatus)==0&&submit_btn&&save_btn){if(cint(doc.__unsaved)){$(save_btn).addClass('btn-info');$(save_btn).find('i').addClass('icon-white');$(submit_btn).removeClass('btn-info');$(submit_btn).find('i').removeClass('icon-white');}else{$(submit_btn).addClass('btn-info');$(submit_btn).find('i').addClass('icon-white');$(save_btn).removeClass('btn-info');$(save_btn).find('i').removeClass('icon-white');}}}
|
||||
_f.FrmHeader.prototype.refresh_labels=function(f){var ph=this.page_head;var me=this;this.dt_area.innerHTML=get_doctype_label(f.doctype);this.dn_area.innerHTML='';if(!f.meta.issingle)
|
||||
_f.FrmHeader.prototype.refresh_labels=function(f){var ph=this.page_head;var me=this;this.dt_area.innerHTML=get_doctype_label(f.doctype);if(f.meta.issingle)$(this.dn_area).toggle(false);this.dn_area.innerHTML='';if(!f.meta.issingle)
|
||||
this.dn_area.innerHTML=f.docname;$(this.dn_area).removeClass('background-fade-in').css('background-color','#ff8')
|
||||
var doc=locals[f.doctype][f.docname];var sl=this.get_status_tags(doc,f);this.set_save_submit_color(doc);var t=this.status_area;t.innerHTML='';t.appendChild(sl[0]);if(sl[1])t.appendChild(sl[1]);this.timestamp_area.innerHTML=me.get_timestamp(doc);setTimeout('$(cur_frm.frm_head.dn_area).addClass("background-fade-in")\
|
||||
var doc=locals[f.doctype][f.docname];var sl=this.get_status_tags(doc,f);this.set_save_submit_color(doc);var t=this.status_area;t.innerHTML='';t.appendChild(sl[0]);if(sl[1])t.appendChild(sl[1]);setTimeout('$(cur_frm.frm_head.dn_area).addClass("background-fade-in")\
|
||||
.css("background-color", "white")',1500)}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form.js
|
||||
*/
|
||||
wn.provide('_f');_f.frms={};_f.edit_record=function(dt,dn){if(!_f.frm_dialog){_f.frm_dialog=new _f.FrmDialog();}
|
||||
var d=_f.frm_dialog;wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!_f.frms[dt]){_f.frms[dt]=new _f.Frm(dt,d.body);}
|
||||
var f=_f.frms[dt];if(f.meta.istable){f.parent_doctype=cur_frm.doctype;f.parent_docname=cur_frm.docname;}
|
||||
d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);d.dialog.show();})})}
|
||||
_f.Frm=function(doctype,parent){this.docname='';this.doctype=doctype;this.display=0;var me=this;this.is_editable={};this.opendocs={};this.sections=[];this.grids=[];this.cscript={};this.pformat={};this.fetch_dict={};this.parent=parent;this.tinymce_id_list=[];this.setup_meta(doctype);rename_observers.push(this);}
|
||||
wn.provide('_f');_f.frms={};_f.Frm=function(doctype,parent){this.docname='';this.doctype=doctype;this.display=0;var me=this;this.is_editable={};this.opendocs={};this.sections=[];this.grids=[];this.cscript={};this.pformat={};this.fetch_dict={};this.parent=parent;this.tinymce_id_list=[];this.setup_meta(doctype);var me=this;$(document).bind('rename',function(event,dt,old_name,new_name){if(dt==me.doctype)
|
||||
me.rename_notify(dt,old_name,new_name)});}
|
||||
_f.Frm.prototype.check_doctype_conflict=function(docname){var me=this;if(this.doctype=='DocType'){if(wn.views.formview[docname]){msgprint("Cannot open DocType when its instance is open")
|
||||
throw'doctype open conflict'}}else{if(wn.views.formview.DocType&&wn.views.formview.DocType.frm.opendocs[this.doctype]){msgprint("Cannot open instance when its DocType is open")
|
||||
throw'doctype open conflict'}}}
|
||||
_f.Frm.prototype.setup=function(){var me=this;this.fields=[];this.fields_dict={};this.wrapper=this.parent;this.setup_print_layout();this.saved_wrapper=$a(this.wrapper,'div');this.setup_std_layout();this.setup_client_script();this.setup_done=true;}
|
||||
_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.back();});}
|
||||
_f.Frm.prototype.setup_print_layout=function(){this.print_wrapper=$a(this.wrapper,'div');this.print_head=$a(this.print_wrapper,'div');this.print_body=$a(this.print_wrapper,'div','layout_wrapper',{padding:'23px',minHeight:'800px'});var t=make_table(this.print_head,1,2,'100%',[],{padding:'6px'});this.view_btn_wrapper=$a($td(t,0,0),'span','green_buttons');this.view_btn=$btn(this.view_btn_wrapper,'View Details',function(){cur_frm.edit_doc()},{marginRight:'4px'},'green');this.print_btn=$btn($td(t,0,0),'Print',function(){cur_frm.print_doc()});$y($td(t,0,1),{textAlign:'right'});this.print_close_btn=$btn($td(t,0,1),'Close',function(){window.back();});}
|
||||
_f.Frm.prototype.onhide=function(){if(_f.cur_grid_cell)_f.cur_grid_cell.grid.cell_deselect();}
|
||||
_f.Frm.prototype.setup_std_layout=function(){this.page_layout=new wn.PageLayout({parent:this.wrapper,main_width:this.in_dialog?'100%':'75%',sidebar_width:this.in_dialog?'0%':'25%'})
|
||||
this.meta.section_style='Simple';this.layout=new Layout(this.page_layout.body,'100%');if(this.in_dialog){$(this.page_layout.wrapper).removeClass('layout-wrapper-background');$(this.page_layout.main).removeClass('layout-main-section');$(this.page_layout.sidebar_area).toggle(false);}else{this.setup_sidebar();}
|
||||
_f.Frm.prototype.setup_std_layout=function(){this.page_layout=new wn.PageLayout({parent:this.wrapper,main_width:this.meta.in_dialog?'100%':'75%',sidebar_width:this.meta.in_dialog?'0%':'25%'})
|
||||
this.meta.section_style='Simple';this.layout=new Layout(this.page_layout.body,'100%');if(this.meta.in_dialog){$(this.page_layout.wrapper).removeClass('layout-wrapper-background');$(this.page_layout.main).removeClass('layout-main-section');$(this.page_layout.sidebar_area).toggle(false);}else{this.setup_sidebar();}
|
||||
this.setup_footer();if(!(this.meta.istable||user=='Guest'))this.frm_head=new _f.FrmHeader(this.page_layout.head,this);if(this.frm_head&&this.meta.in_dialog)$dh(this.frm_head.page_head.close_btn);if(this.meta.colour)
|
||||
this.layout.wrapper.style.backgroundColor='#'+this.meta.colour.split(':')[1];this.setup_fields_std();}
|
||||
_f.Frm.prototype.setup_print=function(){var fl=getchildren('DocFormat',this.meta.name,'formats','DocType');var l=[];this.default_format='Standard';if(fl.length){this.default_format=fl[0].format;for(var i=0;i<fl.length;i++)
|
||||
@ -1756,9 +1656,9 @@ _p.show_dialog();}
|
||||
_f.Frm.prototype.email_doc=function(){if(!_e.dialog)_e.make();sel=this.print_sel;var c=$td(_e.dialog.rows['Format'].tab,0,1);if(c.cur_sel){c.removeChild(c.cur_sel);c.cur_sel=null;}
|
||||
c.appendChild(this.print_sel);c.cur_sel=this.print_sel;_e.dialog.widgets['Send With Attachments'].checked=0;if(cur_frm.doc.file_list){$ds(_e.dialog.rows['Send With Attachments']);}else{$dh(_e.dialog.rows['Send With Attachments']);}
|
||||
_e.dialog.widgets['Subject'].value=get_doctype_label(this.meta.name)+': '+this.docname;_e.dialog.show();}
|
||||
_f.Frm.prototype.rename_notify=function(dt,old,name){if(this.doctype!=dt)return;this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this.docname==old)
|
||||
_f.Frm.prototype.rename_notify=function(dt,old,name){this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this.docname==old)
|
||||
this.docname=name;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
|
||||
this.opendocs[old]=false;this.opendocs[name]=true;}
|
||||
delete this.opendocs[old];this.opendocs[name]=true;}
|
||||
_f.Frm.prototype.set_heading=function(){if(!this.meta.istable&&this.frm_head)this.frm_head.refresh_labels(this);}
|
||||
_f.Frm.prototype.setup_meta=function(){this.meta=get_local('DocType',this.doctype);this.perm=get_perm(this.doctype);this.setup_print();}
|
||||
_f.Frm.prototype.setup_sidebar=function(){this.sidebar=new wn.widgets.form.sidebar.Sidebar(this);}
|
||||
@ -1797,9 +1697,8 @@ if(this.docname){if(!this.check_doc_perm())return;if(!this.setup_done)this.setup
|
||||
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);}
|
||||
if(!this.meta.istable){this.refresh_header();this.sidebar&&this.sidebar.refresh();}
|
||||
this.runclientscript('refresh');$(document).trigger('form_refresh')
|
||||
this.refresh_fields();this.refresh_dependency();this.refresh_footer();if(this.layout)this.layout.show();if(cur_frm.cscript.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('refresh');$(document).trigger('form_refresh');this.refresh_fields();this.refresh_dependency();this.refresh_footer();if(this.layout)this.layout.show();if(cur_frm.cscript.is_onload){this.runclientscript('onload_post_render',this.doctype,this.docname);}
|
||||
$(this.wrapper).find('.form-layout-row :input:first').focus();}else{this.refresh_header();if(this.print_wrapper){this.refresh_print_layout();}
|
||||
this.runclientscript('edit_status_changed');}
|
||||
$(cur_frm.wrapper).trigger('render_complete');}}
|
||||
_f.Frm.prototype.refresh_footer=function(){var f=this.page_layout.footer;if(f.save_area){if(get_url_arg('embed')||(this.editable&&!this.meta.in_dialog&&this.doc.docstatus==0&&!this.meta.istable&&this.get_doc_perms()[WRITE])){f.show_save();}else{f.hide_save();}}}
|
||||
@ -1825,12 +1724,11 @@ locals[this.doctype][this.docname].trash_reason=reason;}
|
||||
if(save_action=='Cancel'){var reason=prompt('Reason for cancellation (mandatory)','');if(!strip(reason)){msgprint('Reason is mandatory, not cancelled');return;}
|
||||
locals[this.doctype][this.docname].cancel_reason=reason;locals[this.doctype][this.docname].cancelled_on=dateutil.full_str();locals[this.doctype][this.docname].cancelled_by=user;}else if(save_action=='Update'){}else{validated=true;if(this.cscript.validate)
|
||||
this.runclientscript('validate',this.doctype,this.docname);if(!validated){this.savingflag=false;return'Error';}}
|
||||
var ret_fn=function(r){if(user=='Guest'&&!r.exc){$dh(me.page_layout.wrapper);$ds(me.saved_wrapper);me.saved_wrapper.innerHTML='<div style="padding: 150px 16px; text-align: center; font-size: 14px;">'
|
||||
var ret_fn=function(r){me.savingflag=false;if(user=='Guest'&&!r.exc){$dh(me.page_layout.wrapper);$ds(me.saved_wrapper);me.saved_wrapper.innerHTML='<div style="padding: 150px 16px; text-align: center; font-size: 14px;">'
|
||||
+(cur_frm.message_after_save?cur_frm.message_after_save:'Your information has been sent. Thank you!')
|
||||
+'</div>';return;}
|
||||
if(!me.meta.istable){me.refresh();}
|
||||
if(call_back){if(call_back=='home'){loadpage('_home');return;}
|
||||
call_back(r);}}
|
||||
if(call_back){call_back(r);}}
|
||||
var me=this;var ret_fn_err=function(r){var doc=locals[me.doctype][me.docname];me.savingflag=false;ret_fn(r);}
|
||||
this.savingflag=true;if(this.docname&&validated){scroll(0,0);return this.savedoc(save_action,ret_fn,ret_fn_err);}}
|
||||
_f.Frm.prototype.runscript=function(scriptname,callingfield,onrefresh){var me=this;if(this.docname){var doclist=compress_doclist(make_doclist(this.doctype,this.docname));if(callingfield)callingfield.input.disabled=true;$c('runserverobj',{'docs':doclist,'method':scriptname},function(r,rtxt){if(onrefresh)
|
||||
@ -2152,7 +2050,7 @@ CommentList.prototype.run=function(){this.lst.run();}
|
||||
CommentList.prototype.make_input=function(){var me=this;this.input=$a(this.input_area,'textarea','',{height:'60px',width:'300px',fontSize:'14px'});this.btn=$btn($a(this.input_area,'div'),'Post',function(){me.add_comment();},{marginTop:'8px'});}
|
||||
CommentList.prototype.add_comment=function(){var me=this;var callback=function(input,dt,dn){me.lst.run();}
|
||||
wn.widgets.form.comments.add(this.input,cur_frm.docname,cur_frm.doctype,callback)}
|
||||
CommentList.prototype.make_lst=function(){if(!this.lst){var l=new Listing('Comments',1);var me=this;l.colwidths=['100%'];l.opts.hide_export=1;l.opts.hide_print=1;l.opts.hide_refresh=1;l.opts.no_border=1;l.opts.hide_rec_label=0;l.opts.show_calc=0;l.opts.round_corners=0;l.opts.alt_cell_style={};l.opts.cell_style={padding:'3px'};l.no_rec_message='No comments yet. Be the first one to comment!';l.get_query=function(){this.query=repl("select t1.name, t1.comment, t1.comment_by, '', \
|
||||
CommentList.prototype.make_lst=function(){if(!this.lst){wn.require('lib/js/legacy/widgets/listing.js');var l=new Listing('Comments',1);var me=this;l.colwidths=['100%'];l.opts.hide_export=1;l.opts.hide_print=1;l.opts.hide_refresh=1;l.opts.no_border=1;l.opts.hide_rec_label=0;l.opts.show_calc=0;l.opts.round_corners=0;l.opts.alt_cell_style={};l.opts.cell_style={padding:'3px'};l.no_rec_message='No comments yet. Be the first one to comment!';l.get_query=function(){this.query=repl("select t1.name, t1.comment, t1.comment_by, '', \
|
||||
t1.creation, t1.comment_doctype, t1.comment_docname, \
|
||||
ifnull(concat_ws(' ',ifnull(t2.first_name,''),ifnull(t2.middle_name,''),\
|
||||
ifnull(t2.last_name,'')),''), '', \
|
||||
@ -2174,7 +2072,13 @@ CommentItem.prototype.cmt_delete=function(cell,ri,ci,d){var me=this;if(d[ri][2]=
|
||||
/*
|
||||
* lib/js/legacy/wn/widgets/form/sidebar.js
|
||||
*/
|
||||
wn.widgets.form.sidebar={Sidebar:function(form){var me=this;this.form=form;this.opts={sections:[{title:'Actions',items:[{type:'link',label:'New',icon:'icon-plus',display:function(){return in_list(profile.can_create,form.doctype)},onclick:function(){new_doc(me.form.doctype)}},{type:'link',label:'List',icon:'icon-list',display:function(){return true;},onclick:function(){window.location.href="#!List/"+me.form.doctype}},{type:'link',label:'Refresh',icon:'icon-refresh',onclick:function(){me.form.reload_doc()}},{type:'link',label:'Print',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_print);},icon:'icon-print',onclick:function(){me.form.print_doc()}},{type:'link',label:'Email',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_email);},icon:'icon-envelope',onclick:function(){me.form.email_doc()}},{type:'link',label:'Copy',display:function(){return in_list(profile.can_create,me.form.doctype)&&!me.form.meta.allow_copy},icon:'icon-file',onclick:function(){me.form.copy_doc()}},{type:'link',label:'Delete',display:function(){return me.form.meta.allow_trash&&cint(me.form.doc.docstatus)!=2&&(!me.form.doc.__islocal)&&me.form.perm[0][CANCEL]},icon:'icon-remove-sign',onclick:function(){me.form.savetrash()}}]},{title:'Assign To',render:function(wrapper){me.form.assign_to=new wn.widgets.form.sidebar.AssignTo(wrapper,me,me.form.doctype,me.form.docname);},display:function(){if(me.form.doc.__local)return false;else return true;}},{title:'Attachments',render:function(wrapper){me.form.attachments=new wn.widgets.form.sidebar.Attachments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return me.form.meta.allow_attach}},{title:'Comments',render:function(wrapper){new wn.widgets.form.sidebar.Comments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return!me.form.doc.__islocal}},{title:'Tags',render:function(wrapper){me.form.taglist=new TagList(wrapper,me.form.doc._user_tags?me.form.doc._user_tags.split(','):[],me.form.doctype,me.form.docname,0,function(){});},display:function(){return!me.form.doc.__islocal}},{title:'Help',render:function(wrapper){if(!wn.md2html){wn.require('lib/js/lib/showdown.js');wn.md2html=new Showdown.converter();}
|
||||
wn.widgets.form.sidebar={Sidebar:function(form){var me=this;this.form=form;this.opts={sections:[{title:'Actions',items:[{type:'link',label:'New',icon:'icon-plus',display:function(){return in_list(profile.can_create,form.doctype)},onclick:function(){new_doc(me.form.doctype)}},{type:'link',label:'List',icon:'icon-list',display:function(){return true;},onclick:function(){window.location.href="#!List/"+me.form.doctype}},{type:'link',label:'Refresh',icon:'icon-refresh',onclick:function(){me.form.reload_doc()}},{type:'link',label:'Print',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_print);},icon:'icon-print',onclick:function(){me.form.print_doc()}},{type:'link',label:'Email',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_email);},icon:'icon-envelope',onclick:function(){me.form.email_doc()}},{type:'link',label:'Copy',display:function(){return in_list(profile.can_create,me.form.doctype)&&!me.form.meta.allow_copy},icon:'icon-file',onclick:function(){me.form.copy_doc()}},{type:'link',label:'Delete',display:function(){return me.form.meta.allow_trash&&cint(me.form.doc.docstatus)!=2&&(!me.form.doc.__islocal)&&me.form.perm[0][CANCEL]},icon:'icon-remove-sign',onclick:function(){me.form.savetrash()}}]},{title:'Assign To',render:function(wrapper){me.form.assign_to=new wn.widgets.form.sidebar.AssignTo(wrapper,me,me.form.doctype,me.form.docname);},display:function(){if(me.form.doc.__local)return false;else return true;}},{title:'Attachments',render:function(wrapper){me.form.attachments=new wn.widgets.form.sidebar.Attachments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return me.form.meta.allow_attach}},{title:'Comments',render:function(wrapper){new wn.widgets.form.sidebar.Comments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return!me.form.doc.__islocal}},{title:'Tags',render:function(wrapper){me.form.taglist=new TagList(wrapper,me.form.doc._user_tags?me.form.doc._user_tags.split(','):[],me.form.doctype,me.form.docname,0,function(){});},display:function(){return!me.form.doc.__islocal}},{title:'Users',render:function(wrapper){var doc=cur_frm.doc;var scrub_date=function(d){if(d)t=d.split(' ');else return'';return dateutil.str_to_user(t[0])+' '+t[1];}
|
||||
$(wrapper).html(repl('<p>Created:<br> <span class="avatar-small">\
|
||||
<img title="%(created_by)s" src="%(avatar_created)s" /></span> \
|
||||
<span class="help">%(creation)s</span></p>\
|
||||
<p>Modified:<br> <span class="avatar-small">\
|
||||
<img title="%(modified_by)s" src="%(avatar_modified)s" /></span> \
|
||||
<span class="help">%(modified)s</span></p>',{created_by:wn.user_info(doc.owner).fullname,avatar_created:wn.user_info(doc.owner).image,creation:scrub_date(doc.creation),modified_by:wn.user_info(doc.modified_by).fullname,avatar_modified:wn.user_info(doc.modified_by).image,modified:scrub_date(doc.modified)}));},display:function(){return!me.form.doc.__islocal}},{title:'Help',render:function(wrapper){if(!wn.md2html){wn.require('lib/js/lib/showdown.js');wn.md2html=new Showdown.converter();}
|
||||
$a(wrapper,'div','help',{},wn.md2html.makeHtml(me.form.meta.description));},display:function(){return me.form.meta.description}}]}
|
||||
this.refresh=function(){var parent=this.form.page_layout.sidebar_area;if(!this.sidebar){this.sidebar=new wn.widgets.PageSidebar(parent,this.opts);}else{this.sidebar.refresh();}}}}
|
||||
/*
|
||||
@ -2213,7 +2117,7 @@ wn.widgets.form.file_upload_done=function(doctype,docname,fileid,filename,at_id,
|
||||
fl.push(filename+','+fileid)
|
||||
doc.file_list=fl.join('\n');}
|
||||
else
|
||||
doc.file_list=filename+','+fileid;doc.modified=new_timestamp;var frm=frms[doctype];frm.attachments.dialog.hide();msgprint('File Uploaded Sucessfully.');frm.refresh();}
|
||||
doc.file_list=filename+','+fileid;doc.modified=new_timestamp;var frm=wn.views.formview[doctype].frm;frm.attachments.dialog.hide();msgprint('File Uploaded Sucessfully.');frm.refresh();}
|
||||
/*
|
||||
* lib/js/legacy/wn/widgets/form/assign_to.js
|
||||
*/
|
||||
@ -2233,7 +2137,7 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu
|
||||
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
|
||||
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
|
||||
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
|
||||
var t=to_open();if(t){wn.set_route(t);}else if(home_page){loadpage(home_page);}
|
||||
var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);}
|
||||
wn.route();$dh('startup_div');$ds('body_div');}
|
||||
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
|
||||
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
|
||||
|
@ -99,7 +99,7 @@ wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/user.js
|
||||
*/
|
||||
@ -146,7 +146,7 @@ wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();swit
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.set_route=function(route){window.location.hash=route;}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;}
|
||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
|
||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
|
||||
/*
|
||||
@ -195,7 +195,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype,me.new_doc_onload,true,me.new_doc_onsave);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
|
||||
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
|
||||
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')}
|
||||
@ -321,7 +321,8 @@ if(me.wrapper[event]){me.wrapper[event](me.wrapper);}}catch(e){console.log(e);}}
|
||||
/*
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})}}
|
||||
/*
|
||||
* lib/js/wn/views/reportview.js
|
||||
@ -904,7 +905,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();this.make_filters();},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype,me.new_doc_onload,true,me.new_doc_onsave);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
|
||||
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
|
||||
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
|
||||
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns>1){this.$w.find('.list-toolbar').addClass('btn-group')}
|
||||
@ -1043,12 +1044,13 @@ err_console.onshow=function(){err_console.rows['Error List'].innerHTML='<div sty
|
||||
* lib/js/legacy/webpage/loaders.js
|
||||
*/
|
||||
function loadreport(dt,rep_name,onload){if(rep_name)
|
||||
wn.set_route('Report/'+encodeURIComponent(dt)+'/'+encodeURIComponent(rep_name));else
|
||||
wn.set_route('Report/'+encodeURIComponent(dt));}
|
||||
function loaddoc(doctype,name,onload){doctype=get_label_doctype(doctype);wn.set_route(['Form',encodeURIComponent(doctype),encodeURIComponent(name)].join('/'));}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.set_route(['Form',encodeURIComponent(doctype),encodeURIComponent('New '+doctype)].join('/'));}
|
||||
wn.set_route('Report',dt,rep_name);else
|
||||
wn.set_route('Report',dt);}
|
||||
function loaddoc(doctype,name,onload){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){console.log(1)
|
||||
_f.edit_record(doctype,name);}else{wn.set_route('Form',doctype,name);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,'New '+doctype);}else{wn.set_route('Form',doctype,'New '+doctype);}})}
|
||||
var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
|
||||
function loaddocbrowser(dt,label,fields){wn.set_route('List/'+encodeURICompontent(dt));}
|
||||
function loaddocbrowser(dt){wn.set_route('List',dt);}
|
||||
/*
|
||||
* lib/js/legacy/webpage/uploader.js
|
||||
*/
|
||||
@ -1098,14 +1100,11 @@ LocalDB.sync=function(list){if(list._kl)list=expand_doclist(list);for(var i=0;i<
|
||||
d.name=LocalDB.get_localname(d.doctype);LocalDB.add(d.doctype,d.name);locals[d.doctype][d.name]=d;if(d.doctype=='DocType'){fields_list[d.name]=[];}else if(d.doctype=='DocField'){if(!d.parent){alert('Error: No parent specified for field "'+d.label+'"');}
|
||||
if(!fields_list[d.parent])fields_list[d.parent]=[];fields_list[d.parent][fields_list[d.parent].length]=d;if(!fields[d.parent])
|
||||
fields[d.parent]={};if(d.fieldname){fields[d.parent][d.fieldname]=d;}else if(d.label){fields[d.parent][d.label]=d;}}
|
||||
if(d.localname)
|
||||
notify_rename_observers(d.doctype,d.localname,d.name);}}
|
||||
if(d.localname){wn.model.new_names[d.localname]=d.name;$(document).trigger('rename',[d.doctype,d.localname,d.name]);delete locals[d.doctype][d.localname];}}}
|
||||
local_name_idx={};LocalDB.get_localname=function(doctype){if(!local_name_idx[doctype])local_name_idx[doctype]=1;var n='New '+get_doctype_label(doctype)+' '+local_name_idx[doctype];local_name_idx[doctype]++;return n;}
|
||||
LocalDB.set_default_values=function(doc){var doctype=doc.doctype;var docfields=fields_list[doctype];if(!docfields){return;}
|
||||
var fields_to_refresh=[];for(var fid=0;fid<docfields.length;fid++){var f=docfields[fid];if(!in_list(no_value_fields,f.fieldtype)&&doc[f.fieldname]==null){var v=LocalDB.get_default_value(f.fieldname,f.fieldtype,f['default']);if(v){doc[f.fieldname]=v;fields_to_refresh.push(f.fieldname);}}}
|
||||
return fields_to_refresh;}
|
||||
LocalDB.is_doc_loaded=function(dt,dn){var exists=false;if(locals[dt]&&locals[dt][dn])exists=true;if(exists&&dt=='DocType'&&!locals[dt][dn].__islocal&&!frms[dt])
|
||||
exists=false;return exists;}
|
||||
function check_perm_match(p,dt,dn){if(!dn)return true;var out=false;if(p.match){if(user_defaults[p.match]){for(var i=0;i<user_defaults[p.match].length;i++){if(user_defaults[p.match][i]==locals[dt][dn][p.match]){return true;}}
|
||||
return false;}else if(!locals[dt][dn][p.match]){return true;}else{return false;}}else{return true;}}
|
||||
function get_perm(doctype,dn,ignore_submit){var perm=[[0,0],];if(in_list(user_roles,'Administrator'))perm[0][READ]=1;var plist=getchildren('DocPerm',doctype,'permissions','DocType');for(var pidx in plist){var p=plist[pidx];var pl=cint(p.permlevel?p.permlevel:0);if(in_list(user_roles,p.role)){if(check_perm_match(p,doctype,dn)){if(!perm[pl])perm[pl]=[];if(!perm[pl][READ]){if(cint(p.read))perm[pl][READ]=1;else perm[pl][READ]=0;}
|
||||
@ -1134,9 +1133,6 @@ var df=get_field(dt,key);if(df&&((!from_amend&&cint(df.no_copy)==1)||in_list(Loc
|
||||
return locals[dt][newdoc];}
|
||||
function make_doclist(dt,dn,deleted){var dl=[];dl[0]=locals[dt][dn];for(var ndt in locals){if(locals[ndt]){for(var ndn in locals[ndt]){var doc=locals[ndt][ndn];if(doc&&doc.parenttype==dt&&(doc.parent==dn||(deleted&&doc.__oldparent==dn))){dl[dl.length]=doc;}}}}
|
||||
return dl;}
|
||||
var rename_observers=[];function notify_rename_observers(dt,old_name,new_name){try{delete locals[dt][old_name];}catch(e){alert("[rename_from_local] No Document for: "+old_name);}
|
||||
for(var i=0;i<rename_observers.length;i++){if(rename_observers[i])
|
||||
rename_observers[i].rename_notify(dt,old_name,new_name);}}
|
||||
var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_doclist('DocType',dt);if(!local_dt[dt])local_dt[dt]={};if(!local_dt[dt][dn])local_dt[dt][dn]={};for(var i=0;i<dl.length;i++){var d=dl[i];if(d.doctype=='DocField'){var key=d.fieldname?d.fieldname:d.label;local_dt[dt][dn][key]=copy_dict(d);}}}
|
||||
Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(fields[dt])var d=fields[dt][fn];if(d)return d;}
|
||||
return{};}
|
||||
@ -1164,7 +1160,6 @@ function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
return obj;}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
|
||||
all_clear=tmp;}}
|
||||
var f=frms[dt];if(f&&!all_clear){if(f)f.savingflag=false;return'Error';}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
@ -1182,7 +1177,7 @@ var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Gu
|
||||
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
|
||||
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
|
||||
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
|
||||
var t=to_open();if(t){wn.set_route(t);}else if(home_page){loadpage(home_page);}
|
||||
var t=to_open();if(t){window.location.hash=t;}else if(home_page){loadpage(home_page);}
|
||||
wn.route();$dh('startup_div');$ds('body_div');}
|
||||
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
|
||||
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
|
||||
@ -1264,4 +1259,4 @@ item.route=item.url||item.custom_page;$parent_li.find('.dropdown-menu').append(r
|
||||
<a href="https://erpnext.com">erpnext.com</a></div>\
|
||||
</div>',wn.boot.website_settings));this.make_items();},make_items:function(){var items=wn.boot.website_menus
|
||||
for(var i=0;i<items.length;i++){var item=items[i];if(!item.parent_label&&item.parentfield=='footer_items'){item.route=item.url||item.custom_page;$('.web-footer-menu ul').append(repl('<li><a href="#!%(route)s" \
|
||||
data-label="%(label)s">%(label)s</a></li>',item))}}}});$(document).bind('startup',function(){})
|
||||
data-label="%(label)s">%(label)s</a></li>',item))}}}});$(document).bind('startup',function(){})
|
@ -1 +1 @@
|
||||
1207
|
||||
1244
|
Loading…
x
Reference in New Issue
Block a user