Merge branch 'handlerupdate' of github.com:webnotes/erpnext into handlerupdate
This commit is contained in:
commit
cb11585ff1
@ -114,7 +114,6 @@ div.comment { color: #444; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#body_div {
|
div#body_div {
|
||||||
position: relative;
|
|
||||||
display: none;
|
display: none;
|
||||||
padding-right: 7px;
|
padding-right: 7px;
|
||||||
width: 900px;
|
width: 900px;
|
||||||
@ -125,12 +124,6 @@ div#body_div {
|
|||||||
.content {
|
.content {
|
||||||
width: 900px;
|
width: 900px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
position: absolute;
|
|
||||||
-webkit-transition:all 0.5s ease-in-out;
|
|
||||||
-moz-transition:all 0.5s ease-in-out;
|
|
||||||
-o-transition:all 0.5s ease-in-out;
|
|
||||||
-ms-transition:all 0.5s ease-in-out;
|
|
||||||
transition:all 0.5s ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.background-fade-in {
|
.background-fade-in {
|
||||||
@ -140,25 +133,6 @@ div#body_div {
|
|||||||
transition: background 1s ease-in;
|
transition: background 1s ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* selector for open pages */
|
|
||||||
#opened-page-selector {
|
|
||||||
width: 900px;
|
|
||||||
height: 900px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
opacity: 0;
|
|
||||||
background-color: #bdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
#opened-page-selector.active {
|
|
||||||
opacity: 0.6;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popover-container {
|
|
||||||
height: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
@ -3505,7 +3479,7 @@ span, div, td, input, textarea, button, select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: url(../images/stripedbg.png) repeat;
|
background: url(../lib/images/ui/redbeech.jpg) repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small {
|
.small {
|
||||||
|
@ -114,7 +114,6 @@ div.comment { color: #444; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
div#body_div {
|
div#body_div {
|
||||||
position: relative;
|
|
||||||
display: none;
|
display: none;
|
||||||
padding-right: 7px;
|
padding-right: 7px;
|
||||||
width: 900px;
|
width: 900px;
|
||||||
@ -125,12 +124,6 @@ div#body_div {
|
|||||||
.content {
|
.content {
|
||||||
width: 900px;
|
width: 900px;
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
position: absolute;
|
|
||||||
-webkit-transition:all 0.5s ease-in-out;
|
|
||||||
-moz-transition:all 0.5s ease-in-out;
|
|
||||||
-o-transition:all 0.5s ease-in-out;
|
|
||||||
-ms-transition:all 0.5s ease-in-out;
|
|
||||||
transition:all 0.5s ease-in-out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.background-fade-in {
|
.background-fade-in {
|
||||||
@ -140,25 +133,6 @@ div#body_div {
|
|||||||
transition: background 1s ease-in;
|
transition: background 1s ease-in;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* selector for open pages */
|
|
||||||
#opened-page-selector {
|
|
||||||
width: 900px;
|
|
||||||
height: 900px;
|
|
||||||
position: absolute;
|
|
||||||
z-index: 100;
|
|
||||||
opacity: 0;
|
|
||||||
background-color: #bdf;
|
|
||||||
}
|
|
||||||
|
|
||||||
#opened-page-selector.active {
|
|
||||||
opacity: 0.6;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popover-container {
|
|
||||||
height: 400px;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
@ -1645,7 +1619,7 @@ span, div, td, input, textarea, button, select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: url(../images/stripedbg.png) repeat;
|
background: url(../lib/images/ui/redbeech.jpg) repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small {
|
.small {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="layout_wrapper">
|
<div class="layout_wrapper">
|
||||||
<div id="ab_header"></div>
|
<div id="ab_header"></div>
|
||||||
<div id="ab_body" style="margin: 16px"></div>
|
<div id="ab_body" style="margin: 16px;"></div>
|
||||||
</div>
|
</div>
|
@ -46,7 +46,7 @@ pscript.make_chart = function(b) {
|
|||||||
//================== table body======================================
|
//================== table body======================================
|
||||||
var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
|
var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
|
||||||
$y($td(ac_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px"});
|
$y($td(ac_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px"});
|
||||||
pscript.account_tree = $a($td(ac_main_grid,0,0),'div');
|
pscript.account_tree = $a($td(ac_main_grid,0,0),'div', '',{minHeight:'400px'});
|
||||||
$y($td(ac_main_grid,0,1),{border: "1px solid #DDD"});
|
$y($td(ac_main_grid,0,1),{border: "1px solid #DDD"});
|
||||||
pscript.la = $a($td(ac_main_grid,0,1),'div');
|
pscript.la = $a($td(ac_main_grid,0,1),'div');
|
||||||
pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
|
pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
|
||||||
|
@ -393,12 +393,12 @@ cur_frm.cscript.calc_amount = function(doc, n) {
|
|||||||
refresh_field('net_total');
|
refresh_field('net_total');
|
||||||
refresh_field('net_total_import');
|
refresh_field('net_total_import');
|
||||||
|
|
||||||
cur_frm.cscript.val_cal_charges(doc, cdt, cdn, tname, fname, other_fname);
|
cur_frm.cscript.val_cal_charges(doc, tname, fname, other_fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//======== Function was broken away from cur_frm.cscript.calc_amount as PV has fieldname 'rate' instead of 'purchase_rate'===========
|
//======== Function was broken away from cur_frm.cscript.calc_amount as PV has fieldname 'rate' instead of 'purchase_rate'===========
|
||||||
cur_frm.cscript.val_cal_charges = function(doc, cdt, cdn, tname, fname, other_fname){
|
cur_frm.cscript.val_cal_charges = function(doc, tname, fname, other_fname){
|
||||||
|
|
||||||
doc = locals[doc.doctype][doc.name]
|
doc = locals[doc.doctype][doc.name]
|
||||||
if(flt(doc.net_total) > 0) {
|
if(flt(doc.net_total) > 0) {
|
||||||
@ -416,7 +416,7 @@ cur_frm.cscript.val_cal_charges = function(doc, cdt, cdn, tname, fname, other_fn
|
|||||||
}
|
}
|
||||||
cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
|
cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
|
||||||
}
|
}
|
||||||
cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
|
cur_frm.cscript.calc_doc_values(doc, tname, fname, other_fname); // calculates total amounts
|
||||||
|
|
||||||
refresh_many(['net_total', 'grand_total', 'rounded_total', 'grand_total_import', 'rounded_total_import', 'in_words', 'in_words_import', 'purchase_tax_details', 'total_tax', 'other_charges_added', 'other_charges_deducted', 'net_total_import', 'other_charges_added_import', 'other_charges_deducted_import']);
|
refresh_many(['net_total', 'grand_total', 'rounded_total', 'grand_total_import', 'rounded_total_import', 'in_words', 'in_words_import', 'purchase_tax_details', 'total_tax', 'other_charges_added', 'other_charges_deducted', 'net_total_import', 'other_charges_added_import', 'other_charges_deducted_import']);
|
||||||
|
|
||||||
@ -545,9 +545,10 @@ cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname)
|
|||||||
|
|
||||||
|
|
||||||
// ******* Calculation of total amounts of document (item amount + other charges)****************
|
// ******* Calculation of total amounts of document (item amount + other charges)****************
|
||||||
cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
|
cur_frm.cscript.calc_doc_values = function(doc, tname, fname, other_fname) {
|
||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
var net_total = 0; var total_tax = 0; var other_charges_added = 0; var other_charges_deducted = 0;
|
var net_total = 0; var total_tax = 0; var other_charges_added = 0;
|
||||||
|
var other_charges_deducted = 0;
|
||||||
var cl = getchildren(tname, doc.name, fname);
|
var cl = getchildren(tname, doc.name, fname);
|
||||||
for(var i = 0; i<cl.length; i++){
|
for(var i = 0; i<cl.length; i++){
|
||||||
net_total += flt(cl[i].amount);
|
net_total += flt(cl[i].amount);
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
color: white;
|
color: white;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-shadow: 0px 0px 3px #000, 0px 0px 3px #000, 0px 0px 2px #000;
|
text-shadow: 1px 1px 2px #000, 1px 1px 2px #000, 1px 1px 2px #000, 0px 0px 2px #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hover and click effects */
|
/* Hover and click effects */
|
||||||
|
@ -49,7 +49,7 @@ SalesBrowser = function(){
|
|||||||
var tr_main_grid = make_table(div_body,1,2,'100%',['60%','40%'],{width: "100%", tableLayout: "fixed", borderCollapse: "collapse", border:"0px", padding:"4px 4px 4px 4px"});
|
var tr_main_grid = make_table(div_body,1,2,'100%',['60%','40%'],{width: "100%", tableLayout: "fixed", borderCollapse: "collapse", border:"0px", padding:"4px 4px 4px 4px"});
|
||||||
|
|
||||||
$y($td(tr_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px", width: "60%"});
|
$y($td(tr_main_grid,0,0),{border: "1px solid #dddddd", padding: "8px", width: "60%"});
|
||||||
this.tree_area = $a($td(tr_main_grid,0,0),'div');
|
this.tree_area = $a($td(tr_main_grid,0,0),'div','',{minHeight:'400px'});
|
||||||
|
|
||||||
$y($td(tr_main_grid,0,1),{border: "1px solid #DDD"});
|
$y($td(tr_main_grid,0,1),{border: "1px solid #DDD"});
|
||||||
this.detail_area = $a($td(tr_main_grid,0,1),'div');
|
this.detail_area = $a($td(tr_main_grid,0,1),'div');
|
||||||
|
@ -13,7 +13,7 @@ span, div, td, input, textarea, button, select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: url(../images/stripedbg.png) repeat;
|
background: url(../images/redbeech.jpg) repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
.small {
|
.small {
|
||||||
|
@ -27,18 +27,19 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
|
|||||||
}
|
}
|
||||||
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
|
data.status_html = repl('<span class="label label-%(label_type)s">%(status)s</span>', data);
|
||||||
|
|
||||||
|
data.description = data.description + ' | ' + data.subject;
|
||||||
|
|
||||||
// description
|
// description
|
||||||
if(data.description && data.description.length > 30) {
|
if(data.description && data.description.length > 50) {
|
||||||
data.description = '<span title="'+data.description+'">' + data.description.substr(0,30) + '...</span>';
|
data.description = '<span title="'+data.description+'">' + data.description.substr(0,30) + '...</span>';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
{width: '5%', content:'avatar'},
|
|
||||||
{width: '3%', content:'docstatus'},
|
{width: '3%', content:'docstatus'},
|
||||||
{width: '15%', content:'name'},
|
{width: '15%', content:'name'},
|
||||||
{width: '8%', content:'status_html'},
|
{width: '8%', content:'status_html'},
|
||||||
{width: '60%', content:'tags+subject+description', css: {color:'#aaa'}},
|
{width: '60%', content:'tags+description', css: {color:'#aaa'}},
|
||||||
{width: '10%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
{width: '10%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.hide_dialog = function() {
|
cur_frm.cscript.hide_dialog = function() {
|
||||||
var route = wn.get_route();
|
if(cur_frm.address_list)
|
||||||
cur_frm.address_list.run();
|
cur_frm.address_list.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,8 +38,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.hide_dialog = function() {
|
cur_frm.cscript.hide_dialog = function() {
|
||||||
var route = wn.get_route();
|
if(cur_frm.contact_list)
|
||||||
cur_frm.contact_list.run();
|
cur_frm.contact_list.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BIN
images/redbeech.jpg
Normal file
BIN
images/redbeech.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -182,6 +182,9 @@ c.className=className;}
|
|||||||
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
|
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
|
||||||
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
|
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
|
||||||
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
||||||
|
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||||
|
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||||
|
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/model.js
|
* lib/js/wn/model.js
|
||||||
*/
|
*/
|
||||||
@ -336,16 +339,12 @@ return[me.$w.find('.fieldname_select option:selected').attr('table'),me.field.df
|
|||||||
/*
|
/*
|
||||||
* lib/js/wn/views/container.js
|
* lib/js/wn/views/container.js
|
||||||
*/
|
*/
|
||||||
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.opened=[];this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').css('left',this.pagewidth+this.pagemargin+'px').appendTo(this.container).get(0);if(onshow)
|
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
|
||||||
$(page).bind('show',onshow);if(onshow)
|
$(page).bind('show',onshow);if(onshow)
|
||||||
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
|
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
|
||||||
if(!page){console.log('Page not found '+label);return;}
|
if(!page){console.log('Page not found '+label);return;}
|
||||||
if(this.page){this.move_left(page);$(this.page).trigger('hide');this.opened.push(this.page);if(!this.opened_selector)
|
if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');}
|
||||||
this.select_opened_page();}
|
this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;return this.page;}})
|
||||||
this.page=page;$(this.page).css('left','0px').css('top','0px');$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;this.stack();return this.page;},move_left:function(page){$(page).css('left',(-1*(this.pagewidth+this.pagemargin))+'px');},stack:function(){var me=this;var l=-1*(this.pagewidth+this.pagemargin);var i=0;this.opened=$.map(this.opened,function(p,i){if(p!=me.page)return p;});var pcontent=[];$.map(this.opened,function(p,i){$(p).css('left',l-(i*2)+'px').css('top',(i*2)+'px').css('z-index',i);});},build_open_links:function(p){var open_links=[];var me=this;$.each(me.opened.concat([me.page]),function(i,p){var route=wn.get_route(p._route);if(route[0]=='Form'){var openlist=keys(wn.views.formview[route[1]].frm.opendocs).sort();$.each(openlist,function(i,v){if(me.page!=p||(me.page==p&&me.page.frm.docname!=v)){open_links.push(repl('<p><a href="#!Form/%(dt)s/%(dn)s">%(dn)s (%(dt)s)</a></p>',{dt:route[1],dn:v}));}});}else{if(me.page!=p){open_links.push(repl('<p><a href="%(route)s">%(label)s</a></p>',{route:p._route,label:p.label}));}}});return open_links;},select_opened_page:function(){var me=this;this.opened_selector=$('<div id="opened-page-selector">\
|
|
||||||
<div class="popover-container"></div></div>').appendTo(this.container).hover(function(){$(this).toggleClass('active')}).click(function(){$('#opened-page-selector .popover-container').attr('data-content',me.build_open_links().reverse().join(''));$(this).find('.popover-container').popover('show');me.popoveropen=true;return false;})
|
|
||||||
this.opened_selector.find('.popover-container').popover({title:"Open Pages",trigger:'manual',delay:0});$(document).click(function(){if(me.popoveropen){$('#opened-page-selector .popover-container').popover('hide');me.popoveropen=false;}})
|
|
||||||
this.move_left(this.opened_selector);},show:function(label){return this.change_to(label);}});
|
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/views/doclistview.js
|
* lib/js/wn/views/doclistview.js
|
||||||
*/
|
*/
|
||||||
@ -397,7 +396,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i
|
|||||||
%(label)s</a> \
|
%(label)s</a> \
|
||||||
(%(count)s)</div>\
|
(%(count)s)</div>\
|
||||||
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
|
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
|
||||||
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'5%',content:'check'},{width:'5%',content:'avatar'},{width:'5%',content:'docstatus',css:{"text-align":"center"}},{width:'30%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'10%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
|
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
|
||||||
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
|
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
|
||||||
if(typeof opts.content=='function'){opts.content(parent,data);}
|
if(typeof opts.content=='function'){opts.content(parent,data);}
|
||||||
else if(opts.content=='name'){$(parent).html(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
|
else if(opts.content=='name'){$(parent).html(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
|
||||||
@ -414,7 +413,10 @@ $(parent).html(repl('<span class="bar-outer" style="width: 30px; float: right" \
|
|||||||
<span class="bar-inner %(fully_delivered)s" \
|
<span class="bar-inner %(fully_delivered)s" \
|
||||||
style="width: %(percent)s%;"></span>\
|
style="width: %(percent)s%;"></span>\
|
||||||
</span>',args));}
|
</span>',args));}
|
||||||
else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
|
else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'}
|
||||||
|
if(diff==-1){data.when='Yesterday'}
|
||||||
|
if(diff==-2){data.when='2 days ago'}
|
||||||
|
if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
|
||||||
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}})
|
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}})
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/views/pageview.js
|
* lib/js/wn/views/pageview.js
|
||||||
@ -533,7 +535,7 @@ function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d
|
|||||||
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
|
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
|
||||||
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
|
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
|
||||||
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
|
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
|
||||||
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
|
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
|
||||||
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
|
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
|
||||||
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
|
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
|
||||||
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
|
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
|
||||||
@ -1869,8 +1871,8 @@ _f.cur_grid;_f.cur_grid_ridx;_f.Grid.prototype.set_cell_value=function(cell){if(
|
|||||||
if(v==null){v='';}
|
if(v==null){v='';}
|
||||||
var me=this;if(cell.cellIndex){var ft=hc.fieldtype;if(ft=='Link'&&cur_frm.doc.docstatus<1)ft='Data';$s(cell.div,v,ft,hc.options);}else{cell.div.style.padding='2px';cell.div.style.textAlign='left';cell.innerHTML='';var t=make_table(cell,1,3,'60px',['20px','20px','20px'],{verticalAlign:'middle',padding:'2px'});$y($td(t,0,0),{paddingLeft:'4px'});$td(t,0,0).innerHTML=cell.row.rowIndex+1;if(cur_frm.editable&&this.can_edit){var ed=$a($td(t,0,1),'i','icon-edit',{cursor:'pointer'});ed.cell=cell;ed.title='Edit Row';ed.onclick=function(){_f.cur_grid=me;_f.cur_grid_ridx=this.cell.row.rowIndex;_f.edit_record(me.doctype,this.cell.row.docname,1);}}else{cell.div.innerHTML=(cell.row.rowIndex+1);cell.div.style.cursor='default';cell.div.onclick=function(){}}}}
|
var me=this;if(cell.cellIndex){var ft=hc.fieldtype;if(ft=='Link'&&cur_frm.doc.docstatus<1)ft='Data';$s(cell.div,v,ft,hc.options);}else{cell.div.style.padding='2px';cell.div.style.textAlign='left';cell.innerHTML='';var t=make_table(cell,1,3,'60px',['20px','20px','20px'],{verticalAlign:'middle',padding:'2px'});$y($td(t,0,0),{paddingLeft:'4px'});$td(t,0,0).innerHTML=cell.row.rowIndex+1;if(cur_frm.editable&&this.can_edit){var ed=$a($td(t,0,1),'i','icon-edit',{cursor:'pointer'});ed.cell=cell;ed.title='Edit Row';ed.onclick=function(){_f.cur_grid=me;_f.cur_grid_ridx=this.cell.row.rowIndex;_f.edit_record(me.doctype,this.cell.row.docname,1);}}else{cell.div.innerHTML=(cell.row.rowIndex+1);cell.div.style.cursor='default';cell.div.onclick=function(){}}}}
|
||||||
$(document).bind('click',function(e){var is_target_toolbar=function(){return $(e.target).parents('.grid_tbarlinks').length;}
|
$(document).bind('click',function(e){var is_target_toolbar=function(){return $(e.target).parents('.grid_tbarlinks').length;}
|
||||||
var is_target_input=function(){return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1;}
|
var is_target_input=function(){if(e.target.tagName.toLowerCase()=='option')return true;return $(e.target).parents().get().indexOf(_f.cur_grid_cell)!=-1;}
|
||||||
if(_f.cur_grid_cell&&!is_target_input()&&!is_target_toolbar()){if(!(text_dialog&&text_dialog.display)&&!datepicker_active&&!(selector&&selector.display)){_f.cur_grid_cell.grid.cell_deselect();}}});_f.Grid.prototype.cell_deselect=function(){if(_f.cur_grid_cell){var c=_f.cur_grid_cell;c.grid.remove_template(c);c.div.className='grid_cell_div';if(c.is_odd)c.div.style.border='2px solid '+c.grid.alt_row_bg;else c.div.style.border='2px solid #FFF';_f.cur_grid_cell=null;}}
|
if(_f.cur_grid_cell&&!is_target_input()&&!is_target_toolbar()){if(!(text_dialog&&text_dialog.display)&&!datepicker_active&&!(selector&&selector.display)){_f.cur_grid_cell.grid.cell_deselect();return false;}}});_f.Grid.prototype.cell_deselect=function(){if(_f.cur_grid_cell){var c=_f.cur_grid_cell;c.grid.remove_template(c);c.div.className='grid_cell_div';if(c.is_odd)c.div.style.border='2px solid '+c.grid.alt_row_bg;else c.div.style.border='2px solid #FFF';_f.cur_grid_cell=null;}}
|
||||||
_f.Grid.prototype.cell_select=function(cell,ri,ci){if(ri!=null&&ci!=null)
|
_f.Grid.prototype.cell_select=function(cell,ri,ci){if(ri!=null&&ci!=null)
|
||||||
cell=this.tab.rows[ri].cells[ci];var hc=this.head_row.cells[cell.cellIndex];if(!hc.template){this.make_template(hc);}
|
cell=this.tab.rows[ri].cells[ci];var hc=this.head_row.cells[cell.cellIndex];if(!hc.template){this.make_template(hc);}
|
||||||
hc.template.perm=this.field?this.field.perm:hc.perm;if(hc.fieldname&&hc.template.get_status()=='Write'){this.cell_deselect();cell.div.style.border='2px solid #88F';_f.cur_grid_cell=cell;this.add_template(cell);}}
|
hc.template.perm=this.field?this.field.perm:hc.perm;if(hc.fieldname&&hc.template.get_status()=='Write'){this.cell_deselect();cell.div.style.border='2px solid #88F';_f.cur_grid_cell=cell;this.add_template(cell);}}
|
||||||
|
@ -96,6 +96,9 @@ c.className=className;}
|
|||||||
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
|
if(cs)wn.dom.css(c,cs);if(innerHTML)c.innerHTML=innerHTML;if(onclick)c.onclick=onclick;return c;}
|
||||||
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
|
wn.dom.css=function(ele,s){if(ele&&s){for(var i in s)ele.style[i]=s[i];};return ele;}
|
||||||
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
wn.get_cookie=function(c){var t=""+document.cookie;var ind=t.indexOf(c);if(ind==-1||c=="")return"";var ind1=t.indexOf(';',ind);if(ind1==-1)ind1=t.length;return unescape(t.substring(ind+c.length+1,ind1));}
|
||||||
|
wn.dom.set_box_shadow=function(ele,spread){$(ele).css('-moz-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||||
|
$(ele).css('-webkit-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')
|
||||||
|
$(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/model.js
|
* lib/js/wn/model.js
|
||||||
*/
|
*/
|
||||||
@ -250,16 +253,12 @@ return[me.$w.find('.fieldname_select option:selected').attr('table'),me.field.df
|
|||||||
/*
|
/*
|
||||||
* lib/js/wn/views/container.js
|
* lib/js/wn/views/container.js
|
||||||
*/
|
*/
|
||||||
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.opened=[];this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').css('left',this.pagewidth+this.pagemargin+'px').appendTo(this.container).get(0);if(onshow)
|
wn.provide('wn.pages');wn.provide('wn.views');wn.views.Container=Class.extend({init:function(){this.container=$('#body_div').get(0);this.page=null;this.pagewidth=$('#body_div').width();this.pagemargin=50;},add_page:function(label,onshow,onhide){var page=$('<div class="content"></div>').appendTo(this.container).get(0);if(onshow)
|
||||||
$(page).bind('show',onshow);if(onshow)
|
$(page).bind('show',onshow);if(onshow)
|
||||||
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
|
$(page).bind('hide',onhide);page.label=label;wn.pages[label]=page;return page;},change_to:function(label){var me=this;if(label.tagName){var page=label;}else{var page=wn.pages[label];}
|
||||||
if(!page){console.log('Page not found '+label);return;}
|
if(!page){console.log('Page not found '+label);return;}
|
||||||
if(this.page){this.move_left(page);$(this.page).trigger('hide');this.opened.push(this.page);if(!this.opened_selector)
|
if(this.page){$(this.page).toggle(false);$(this.page).trigger('hide');}
|
||||||
this.select_opened_page();}
|
this.page=page;$(this.page).fadeIn();$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;return this.page;}})
|
||||||
this.page=page;$(this.page).css('left','0px').css('top','0px');$(this.page).trigger('show');this.page._route=window.location.hash;document.title=this.page.label;this.stack();return this.page;},move_left:function(page){$(page).css('left',(-1*(this.pagewidth+this.pagemargin))+'px');},stack:function(){var me=this;var l=-1*(this.pagewidth+this.pagemargin);var i=0;this.opened=$.map(this.opened,function(p,i){if(p!=me.page)return p;});var pcontent=[];$.map(this.opened,function(p,i){$(p).css('left',l-(i*2)+'px').css('top',(i*2)+'px').css('z-index',i);});},build_open_links:function(p){var open_links=[];var me=this;$.each(me.opened.concat([me.page]),function(i,p){var route=wn.get_route(p._route);if(route[0]=='Form'){var openlist=keys(wn.views.formview[route[1]].frm.opendocs).sort();$.each(openlist,function(i,v){if(me.page!=p||(me.page==p&&me.page.frm.docname!=v)){open_links.push(repl('<p><a href="#!Form/%(dt)s/%(dn)s">%(dn)s (%(dt)s)</a></p>',{dt:route[1],dn:v}));}});}else{if(me.page!=p){open_links.push(repl('<p><a href="%(route)s">%(label)s</a></p>',{route:p._route,label:p.label}));}}});return open_links;},select_opened_page:function(){var me=this;this.opened_selector=$('<div id="opened-page-selector">\
|
|
||||||
<div class="popover-container"></div></div>').appendTo(this.container).hover(function(){$(this).toggleClass('active')}).click(function(){$('#opened-page-selector .popover-container').attr('data-content',me.build_open_links().reverse().join(''));$(this).find('.popover-container').popover('show');me.popoveropen=true;return false;})
|
|
||||||
this.opened_selector.find('.popover-container').popover({title:"Open Pages",trigger:'manual',delay:0});$(document).click(function(){if(me.popoveropen){$('#opened-page-selector .popover-container').popover('hide');me.popoveropen=false;}})
|
|
||||||
this.move_left(this.opened_selector);},show:function(label){return this.change_to(label);}});
|
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/views/doclistview.js
|
* lib/js/wn/views/doclistview.js
|
||||||
*/
|
*/
|
||||||
@ -311,7 +310,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i
|
|||||||
%(label)s</a> \
|
%(label)s</a> \
|
||||||
(%(count)s)</div>\
|
(%(count)s)</div>\
|
||||||
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
|
</div>',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}}
|
||||||
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'5%',content:'check'},{width:'5%',content:'avatar'},{width:'5%',content:'docstatus',css:{"text-align":"center"}},{width:'30%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'10%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
|
this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});}
|
||||||
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
|
if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;}
|
||||||
if(typeof opts.content=='function'){opts.content(parent,data);}
|
if(typeof opts.content=='function'){opts.content(parent,data);}
|
||||||
else if(opts.content=='name'){$(parent).html(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
|
else if(opts.content=='name'){$(parent).html(repl('<a href="#!Form/%(doctype)s/%(name)s">%(name)s</a>',data));}
|
||||||
@ -328,7 +327,10 @@ $(parent).html(repl('<span class="bar-outer" style="width: 30px; float: right" \
|
|||||||
<span class="bar-inner %(fully_delivered)s" \
|
<span class="bar-inner %(fully_delivered)s" \
|
||||||
style="width: %(percent)s%;"></span>\
|
style="width: %(percent)s%;"></span>\
|
||||||
</span>',args));}
|
</span>',args));}
|
||||||
else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
|
else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:function(row,data){var me=this;this.prepare_data(data);rowhtml='';$.each(this.columns,function(i,v){rowhtml+=repl('<td style="width: %(width)s"></td>',v);});var tr=$(row).html('<table><tbody><tr>'+rowhtml+'</tr></tbody></table>').find('tr').get(0);$.each(this.columns,function(i,v){me.render_column(data,tr.cells[i],v);});},prepare_data:function(data){data.fullname=wn.user_info(data.owner).fullname;data.avatar=wn.user_info(data.owner).image;data.when=dateutil.str_to_user(data.modified).split(' ')[0];var diff=dateutil.get_diff(dateutil.get_today(),data.modified.split(' ')[0]);if(diff==0){data.when='Today'}
|
||||||
|
if(diff==-1){data.when='Yesterday'}
|
||||||
|
if(diff==-2){data.when='2 days ago'}
|
||||||
|
if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('<span class="label label-info" style="cursor: pointer">'
|
||||||
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}})
|
+strip(t)+'</span>').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}})
|
||||||
/*
|
/*
|
||||||
* lib/js/wn/views/pageview.js
|
* lib/js/wn/views/pageview.js
|
||||||
@ -447,7 +449,7 @@ function same_day(d1,d2){if(d1.getFullYear()==d2.getFullYear()&&d1.getMonth()==d
|
|||||||
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
|
var month_list=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];var month_last={1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
|
||||||
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
|
var month_list_full=['January','February','March','April','May','June','July','August','September','October','November','December'];var week_list=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];var week_list_full=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];function int_to_str(i,len){i=''+i;if(i.length<len)for(c=0;c<(len-i.length);c++)i='0'+i;return i}
|
||||||
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
|
wn.datetime={str_to_obj:function(d){if(!d)return new Date();var tm=[null,null];if(d.search(' ')!=-1){var tm=d.split(' ')[1].split(':');var d=d.split(' ')[0];}
|
||||||
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
|
if(d.search('-')!=-1){var t=d.split('-');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else if(d.search('/')!=-1){var t=d.split('/');return new Date(t[0],t[1]-1,t[2],tm[0],tm[1]);}else{return new Date();}},obj_to_str:function(d){return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-'+int_to_str(d.getDate(),2);},obj_to_user:function(d){return dateutil.str_to_user(dateutil.obj_to_str(d));},get_diff:function(d1,d2){if(typeof d1=='string')d1=dateutil.str_to_obj(d1);if(typeof d2=='string')d2=dateutil.str_to_obj(d2);return((d1-d2)/86400000);},get_day_diff:function(d1,d2){return dateutil.get_diff(new Date(d1.getYear(),d1.getMonth(),d1.getDate(),0,0),new Date(d2.getYear(),d2.getMonth(),d2.getDate(),0,0))},add_days:function(d,days){d.setTime(d.getTime()+(days*24*60*60*1000));return d},add_months:function(d,months){dt=dateutil.str_to_obj(d)
|
||||||
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
|
new_dt=new Date(dt.getFullYear(),dt.getMonth()+months,dt.getDate())
|
||||||
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
|
if(new_dt.getDate()!=dt.getDate()){return dateutil.month_end(new Date(dt.getFullYear(),dt.getMonth()+months,1))}
|
||||||
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
|
return dateutil.obj_to_str(new_dt);},month_start:function(){var d=new Date();return d.getFullYear()+'-'+int_to_str(d.getMonth()+1,2)+'-01';},month_end:function(d){if(!d)var d=new Date();var m=d.getMonth()+1;var y=d.getFullYear();last_date=month_last[m];if(m==2&&(y%4)==0&&((y%100)!=0||(y%400)==0))
|
||||||
|
@ -1 +1 @@
|
|||||||
1307
|
1339
|
||||||
|
Loading…
Reference in New Issue
Block a user