From f1264a7f76848b42e1c1e66990b351d5aad836b1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 13 Apr 2012 11:41:43 +0530 Subject: [PATCH] listing, module pages in appframe --- build.json | 3 +- css/all-app.css | 4 +- .../page/accounts_home/accounts_home.html | 5 +- .../page/accounts_home/accounts_home.js | 2 + .../buying/page/buying_home/buying_home.html | 4 +- .../buying/page/buying_home/buying_home.js | 1 + erpnext/hr/page/hr_home/hr_home.html | 6 +- erpnext/hr/page/hr_home/hr_home.js | 1 + .../page/production_home/production_home.html | 4 +- .../page/production_home/production_home.js | 1 + .../page/projects_home/projects_home.html | 4 +- .../page/projects_home/projects_home.js | 1 + .../page/selling_home/selling_home.html | 6 +- .../selling/page/selling_home/selling_home.js | 1 + erpnext/stock/page/stock_home/stock_home.html | 7 +- erpnext/stock/page/stock_home/stock_home.js | 1 + .../page/support_home/support_home.html | 5 +- .../support/page/support_home/support_home.js | 1 + .../page/website_home/website_home.html | 10 +-- .../website/page/website_home/website_home.js | 1 + js/all-app.js | 44 ++++++------- js/all-web.js | 65 ++++++++++--------- version.num | 2 +- 23 files changed, 105 insertions(+), 74 deletions(-) diff --git a/build.json b/build.json index 9c977b7f5c..dc6613803e 100644 --- a/build.json +++ b/build.json @@ -97,6 +97,7 @@ "lib/js/legacy/utils/dom.js", "lib/js/legacy/utils/handler.js", "lib/js/legacy/utils/msgprint.js", + "lib/js/wn/ui/appframe.js", "lib/js/wn/ui/dialog.js", "lib/js/legacy/widgets/dialog.js", "lib/js/wn/ui/listing.js", @@ -131,7 +132,7 @@ "lib/js/legacy/utils/msgprint.js", "lib/js/legacy/utils/printElement.js", "lib/js/legacy/widgets/form/fields.js", - "lib/js/wn/views/appframe.js", + "lib/js/wn/ui/appframe.js", "lib/js/wn/ui/dialog.js", "lib/js/wn/ui/button.js", "lib/js/legacy/widgets/dialog.js", diff --git a/css/all-app.css b/css/all-app.css index 85bea74aea..a87b4baa8e 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -330,7 +330,7 @@ div.notice { div.form-title { /*background-color: #e0eeff;*/ - padding: 5px 11px 15px 11px; + padding: 5px 19px 15px 19px; margin: -15px -15px 0px -15px; border-bottom: 1px solid #eee; } @@ -338,7 +338,7 @@ div.form-title { div.form-section-head { margin: 11px -15px 3px -15px; border-top: 1px solid #ccc; - padding: 11px 15px 0px 15px; + padding: 11px 23px 0px 23px; } div.form-layout-row:first-child .form-section-head { diff --git a/erpnext/accounts/page/accounts_home/accounts_home.html b/erpnext/accounts/page/accounts_home/accounts_home.html index a2033ec174..398f1e46f3 100644 --- a/erpnext/accounts/page/accounts_home/accounts_home.html +++ b/erpnext/accounts/page/accounts_home/accounts_home.html @@ -1,19 +1,22 @@
+
- ×

Accounts


Journal Voucher

General Ledger Entries

+

Sales Invoice

Bills raised to Customers

+

Purchase Invoice

Bills raised by Suppliers

Chart of Accounts

Structure of books of accounts

+

Chart of Cost Centers

Structure cost centers

diff --git a/erpnext/accounts/page/accounts_home/accounts_home.js b/erpnext/accounts/page/accounts_home/accounts_home.js index 52738a83bd..9915226f86 100644 --- a/erpnext/accounts/page/accounts_home/accounts_home.js +++ b/erpnext/accounts/page/accounts_home/accounts_home.js @@ -16,6 +16,8 @@ pscript['onload_accounts-home'] = function(wrapper) { erpnext.module_page.setup_page('Accounts', wrapper); + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); + if(wn.control_panel.country!='India') { $('.india-specific').toggle(false); } diff --git a/erpnext/buying/page/buying_home/buying_home.html b/erpnext/buying/page/buying_home/buying_home.html index ef521aa4f8..ee10d10c28 100644 --- a/erpnext/buying/page/buying_home/buying_home.html +++ b/erpnext/buying/page/buying_home/buying_home.html @@ -1,17 +1,19 @@
+
- ×

Buying


Purchase Request

Request for purchase

+

Purchase Order

Purchase Orders given to Suppliers

Supplier

Supplier Master

+

Item

Item Master

diff --git a/erpnext/buying/page/buying_home/buying_home.js b/erpnext/buying/page/buying_home/buying_home.js index 1f47b84629..646ed0b178 100644 --- a/erpnext/buying/page/buying_home/buying_home.js +++ b/erpnext/buying/page/buying_home/buying_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_buying-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Buying', wrapper); } \ No newline at end of file diff --git a/erpnext/hr/page/hr_home/hr_home.html b/erpnext/hr/page/hr_home/hr_home.html index 007ee769d4..b49ce092d7 100644 --- a/erpnext/hr/page/hr_home/hr_home.html +++ b/erpnext/hr/page/hr_home/hr_home.html @@ -1,17 +1,21 @@
+
- ×

Human Resources


Attendance

Attendance Mark

+

Leave Application

Applications for leave

+

Expense Claim

Claims for expenses

+

Salary Slip

Monthly salary statement

+

Appraisal

Performance appraisal

diff --git a/erpnext/hr/page/hr_home/hr_home.js b/erpnext/hr/page/hr_home/hr_home.js index 418ed57518..1971b4690b 100644 --- a/erpnext/hr/page/hr_home/hr_home.js +++ b/erpnext/hr/page/hr_home/hr_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_hr-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('HR', wrapper); } \ No newline at end of file diff --git a/erpnext/production/page/production_home/production_home.html b/erpnext/production/page/production_home/production_home.html index 7a20097fc7..77d80193e2 100644 --- a/erpnext/production/page/production_home/production_home.html +++ b/erpnext/production/page/production_home/production_home.html @@ -1,17 +1,19 @@
+
- ×

Production


Production Order

Orders for manufacturing

+

Production Plan

Generate Purchase Requisition (MRP) and Production Orders

Bill of Materials

Bill of Materials (BOM) Master

+

Item

Item Master

diff --git a/erpnext/production/page/production_home/production_home.js b/erpnext/production/page/production_home/production_home.js index 5367815edc..af4ba9db9e 100644 --- a/erpnext/production/page/production_home/production_home.js +++ b/erpnext/production/page/production_home/production_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_production-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Production', wrapper); } \ No newline at end of file diff --git a/erpnext/projects/page/projects_home/projects_home.html b/erpnext/projects/page/projects_home/projects_home.html index 0cb760e7b1..e86aa03d98 100644 --- a/erpnext/projects/page/projects_home/projects_home.html +++ b/erpnext/projects/page/projects_home/projects_home.html @@ -1,13 +1,15 @@
+
- ×

Projects


Project

Project master

+

Task

Project activity / task

+

Timesheet

Timesheet for tasks

diff --git a/erpnext/projects/page/projects_home/projects_home.js b/erpnext/projects/page/projects_home/projects_home.js index 73d6e3303c..187fc57825 100644 --- a/erpnext/projects/page/projects_home/projects_home.js +++ b/erpnext/projects/page/projects_home/projects_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_projects-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Projects', wrapper); } \ No newline at end of file diff --git a/erpnext/selling/page/selling_home/selling_home.html b/erpnext/selling/page/selling_home/selling_home.html index ce45e52184..e6865526cc 100644 --- a/erpnext/selling/page/selling_home/selling_home.html +++ b/erpnext/selling/page/selling_home/selling_home.html @@ -1,21 +1,25 @@
+
- ×

Selling


Lead

Prospective customers

+

Opportunity

Business opportunities

+

Quotation

Quotes sent to Leads / Customers

+

Sales Order

Confirmed orders from Customers

Customer

Customer Master

+

Item

Item Master

diff --git a/erpnext/selling/page/selling_home/selling_home.js b/erpnext/selling/page/selling_home/selling_home.js index e0430d73bc..2561ee4645 100644 --- a/erpnext/selling/page/selling_home/selling_home.js +++ b/erpnext/selling/page/selling_home/selling_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_selling-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Selling', wrapper); } \ No newline at end of file diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index aede4e3552..d1b2507df1 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -1,23 +1,28 @@
+
- ×

Stock


Stock Entry

Transfer stock from one warehouse to another

+

Delivery Note

Delivery (shipment) to customers

+

Purchase Receipt

Goods received from Suppliers

Item

Item Master

+

Serial No

Single unit of an Item

+

Batch

Batch of units of an Item

+

Warehouse

Warehouse is where items are stored

diff --git a/erpnext/stock/page/stock_home/stock_home.js b/erpnext/stock/page/stock_home/stock_home.js index aa33722098..7df9b275e9 100644 --- a/erpnext/stock/page/stock_home/stock_home.js +++ b/erpnext/stock/page/stock_home/stock_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_stock-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Stock', wrapper); } \ No newline at end of file diff --git a/erpnext/support/page/support_home/support_home.html b/erpnext/support/page/support_home/support_home.html index 6c1f790b48..dcabe1ce95 100644 --- a/erpnext/support/page/support_home/support_home.html +++ b/erpnext/support/page/support_home/support_home.html @@ -1,15 +1,18 @@
+
- ×

Support


Support Ticket

Support queries from customers via email or website

+

Customer Issue

Customer Issue against a Serial No (warranty)

+

Maintenance Schedule

Plan for scheduled maintenance contracts

+

Maintenance Visit

Visit report for maintenance visit

diff --git a/erpnext/support/page/support_home/support_home.js b/erpnext/support/page/support_home/support_home.js index b9fd85e390..3b95eb652a 100644 --- a/erpnext/support/page/support_home/support_home.js +++ b/erpnext/support/page/support_home/support_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_support-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Support', wrapper); } \ No newline at end of file diff --git a/erpnext/website/page/website_home/website_home.html b/erpnext/website/page/website_home/website_home.html index f7bb208bea..3252282510 100644 --- a/erpnext/website/page/website_home/website_home.html +++ b/erpnext/website/page/website_home/website_home.html @@ -1,25 +1,25 @@
+
- ×

Website


Web Page

Static (content) web page

+

Product

Product listed in catolog

+

Blog

Weblog (blog) entry

Website Settings

Setup of top navigation bar, footer and logo

-
-
+

Style Settings

Setup of fonts and background

-
-
+

Products Settings

Setup product categories

diff --git a/erpnext/website/page/website_home/website_home.js b/erpnext/website/page/website_home/website_home.js index ec6053f305..51f12baaa7 100644 --- a/erpnext/website/page/website_home/website_home.js +++ b/erpnext/website/page/website_home/website_home.js @@ -15,5 +15,6 @@ // along with this program. If not, see . pscript['onload_website-home'] = function(wrapper) { + wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area')); erpnext.module_page.setup_page('Website', wrapper); } \ No newline at end of file diff --git a/js/all-app.js b/js/all-app.js index 6db411f8c5..859ac6bf2e 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -263,13 +263,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){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);})}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==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},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-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -304,8 +300,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) @@ -374,7 +370,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
\
\
\ -
',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 +
',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);} this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('

No %(doctype_label)s found

\ %(description)s\ @@ -382,8 +378,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid

\ -

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('\ - Delete',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) +

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\ @@ -913,15 +908,15 @@ if(frm){f.frm=frm;if(parent) f.layout_cell=parent.parentNode;} if(f.init)f.init();f.make_body();return f;} /* - * lib/js/wn/views/appframe.js + * lib/js/wn/ui/appframe.js */ -wn.views.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ +wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ \ ×\
').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length) this.$w.append('
');args={label:label,icon:''};if(icon){args.icon='';} this.buttons[label]=$(repl('',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) + %(icon)s %(label)s',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) /* * lib/js/wn/ui/dialog.js */ @@ -939,7 +934,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width) this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) this.make_fields(this.body,this.opts.fields);} -this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} +this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() @@ -1612,7 +1607,7 @@ d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);$(f.page_layout.wr /* * lib/js/legacy/widgets/form/form_header.js */ -_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.views.AppFrame(parent) +_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.ui.AppFrame(parent) this.appframe.$titlebar.append('\ ');this.$w=this.appframe.$w;},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Draft',''],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(cur_frm.doc.__unsaved){labinfo[1]='label-warning'} this.$w.find('.label-area').html(repl('\ @@ -1781,8 +1776,7 @@ this.section_collapse=function(){$(me.row.main_head).find('.head').html(' ' +me.df.label+'');if(no_animation) $(me.row.main_body).toggle(true);else -$(me.row.main_body).slideDown();} -$y(this.row.body,{marginLeft:'17px'});} +$(me.row.main_body).slideDown();}} _f.SectionBreak.prototype.has_data=function(){var me=this;for(var i in me.fields){var f=me.fields[i];var v=f.get_value?f.get_value():null;defaultval=f.df['default']||sys_defaults[f.fieldname]||user_defaults[f.fieldname];if(v&&v!=defaultval){return true;} if(f.df.reqd&&!v){return true;} if(f.df.fieldtype=='Table'){if(f.grid.get_children().length||f.df.reqd){return true;}}} @@ -1891,7 +1885,7 @@ _f.FormGrid.prototype.set_column_label=function(fieldname,label){for(var i=0;i\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){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);})}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==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},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-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -191,8 +187,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) @@ -261,7 +257,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
\
\
\ -
',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 +
',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1 else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);} this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('

No %(doctype_label)s found

\ %(description)s\ @@ -269,8 +265,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid

\ -

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('\ - Delete',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) +

',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length) return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;} me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('

Tags

\ @@ -572,6 +567,16 @@ msg_dialog.custom_onhide=callback;} var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});} var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);} $(wrapper).hide().fadeIn(1000);} +/* + * lib/js/wn/ui/appframe.js + */ +wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('
').appendTo(parent);this.$titlebar=$('
\ + \ + ×\ +
').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length) +this.$w.append('
');args={label:label,icon:''};if(icon){args.icon='';} +this.buttons[label]=$(repl('',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}}) /* * lib/js/wn/ui/dialog.js */ @@ -589,7 +594,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width) this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields) this.make_fields(this.body,this.opts.fields);} -this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} +this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);} this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');} this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});} this.show=function(){if(this.display)return;this.set_postion() @@ -639,13 +644,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
\ \
\ -
\ - \ - Refresh\ - \ - New\ - \ - Filter\ +
\
\
\ More...
\
\
\ - ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){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);})}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==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') + ',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);} +if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('').appendTo(this.$w.find('.list-toolbar')) +if(icon){$('').addClass(icon).appendTo($button);} +$button.html(label).click(click);return $button}},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-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);} +if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');} +if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');} +if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function') this.onrun=a0;if(a0&&a0.callback) this.onrun=a0.callback;if(!a1&&!(a0&&a0.append)) this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1} @@ -680,8 +681,8 @@ if(this.get_args){$.extend(args,this.get_args());} return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}} if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i=this.page_length) -this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length) -me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) +this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('
').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length) +this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field) values.push(f.get_value());}) return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);}) this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname) diff --git a/version.num b/version.num index 3641460c4b..62cab397cc 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1671 \ No newline at end of file +1683 \ No newline at end of file