Merge branch 'shf_rename' of github.com:webnotes/wnframework into shf_rename
This commit is contained in:
commit
019e9f658a
16 changed files with 242 additions and 109 deletions
BIN
css/fonts/pacifico.woff
Normal file
BIN
css/fonts/pacifico.woff
Normal file
Binary file not shown.
|
|
@ -165,7 +165,7 @@ div.loading_div {
|
|||
}
|
||||
|
||||
div.std-footer {
|
||||
margin: 13px 0px;
|
||||
margin: 13px -15px;
|
||||
border-top: 1px solid #AAA;
|
||||
padding: 13px;
|
||||
}
|
||||
|
|
@ -192,6 +192,11 @@ div.std-footer-item {
|
|||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 30px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
|
|
@ -205,9 +210,9 @@ div.std-footer-item {
|
|||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
-webkit-box-shadow: 7px 0px 6px -2px #ddd;
|
||||
box-shadow: 7px 0px 6px -2px #ddd;
|
||||
-moz-box-shadow: 4px 0px 3px #ddd;
|
||||
-webkit-box-shadow: 4px 0px 3px #ddd;
|
||||
box-shadow: 4px 0px 3px #ddd;
|
||||
}
|
||||
|
||||
.layout-side-section {
|
||||
|
|
|
|||
|
|
@ -1,27 +1,22 @@
|
|||
/* FORMS */
|
||||
|
||||
.breadcrumbs-area {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.breadcrumbs {
|
||||
background-color: #e8e8e8;
|
||||
padding: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.breadcrumbs a {
|
||||
color: #000000;
|
||||
div.form-title {
|
||||
/*background-color: #e0eeff;*/
|
||||
padding: 5px 11px 15px 11px;
|
||||
margin: -15px -15px 0px -15px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
div.form-section-head {
|
||||
margin: 11px 0px 3px 0px;
|
||||
margin: 11px -15px 3px -15px;
|
||||
border-top: 1px solid #ccc;
|
||||
padding-top: 11px;
|
||||
padding: 11px 15px 0px 15px;
|
||||
}
|
||||
|
||||
div.form-layout-row:first-child .form-section-head {
|
||||
border-top: 0px solid #ccc !important;
|
||||
border-top: 0px solid #ccc !important;
|
||||
margin-top: 0px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
div.form-section-head h3 {
|
||||
|
|
|
|||
|
|
@ -39,3 +39,11 @@
|
|||
font-weight: 400;
|
||||
src: local('Cabin Regular'), local('Cabin-Regular'), url('../lib/css/fonts/cabin.woff') format('woff');
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Pacifico';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local('Pacifico Regular'), local('Pacifico-Regular'), url('../lib/css/fonts/pacifico.woff') format('woff');
|
||||
}
|
||||
|
||||
|
|
|
|||
27
css/ui/views.css
Normal file
27
css/ui/views.css
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
.breadcrumbs {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.breadcrumbs a {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.appframe-titlebar {
|
||||
padding: 6px;
|
||||
background: #eeeeee; /* Old browsers */
|
||||
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
|
||||
background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
div.appframe-toolbar {
|
||||
padding: 4px;
|
||||
background: #eeeeee;
|
||||
border-top: 1px solid #f8f8f8;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
5
js/core.min.js
vendored
5
js/core.min.js
vendored
|
|
@ -222,9 +222,8 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span clas
|
|||
wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
|
||||
document.title=page.doclistview.label;wn.container.change_to(pagename);})}
|
||||
wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doctype=doctype;this.$page=$(page);this.label=get_doctype_label(doctype);this.label=(this.label.toLowerCase().substr(-4)=='list')?this.label:(this.label+' List');this.make_page();this.setup();},make_page:function(){var me=this;this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="appframe-area"></div>\
|
||||
<div class="layout-main-section">\
|
||||
<a class="close" onclick="window.history.back();">×</a>\
|
||||
<div class="breadcrumbs-area"></div>\
|
||||
<h1>%(label)s</h1>\
|
||||
<hr>\
|
||||
<div class="wnlist-area"><div class="help">Loading...</div></div>\
|
||||
|
|
@ -238,7 +237,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
|
|||
</div>\
|
||||
</div>\
|
||||
<div style="clear: both"></div>\
|
||||
</div>',{label:this.label}));wn.views.breadcrumbs(this.$page.find('.breadcrumbs-area').get(0),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
|
||||
</div>',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').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('<div class="well"><p>No %(doctype_label)s found</p>\
|
||||
%(description)s\
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
* lib/js/legacy/widgets/report_builder/report_builder.js
|
||||
*/
|
||||
_r.ReportContainer=function(){if(user=='Guest'){msgprint("Not Allowed");return;}
|
||||
this.wrapper=$a(wn.container.add_page("Report Builder"),'div','layout-wrapper');var head_div=$a(this.wrapper,'div');this.rb_area=$a(this.wrapper,'div');var me=this;this.rb_dict={};this.page_head=new PageHeader(head_div);$y(this.page_head.wrapper,{marginBottom:'0px'});var run_fn=function(){if(me.cur_rb){me.cur_rb.dt.start_rec=1;me.cur_rb.dt.run();}}
|
||||
var runbtn=this.page_head.add_button('Run',run_fn,1,'ui-icon-circle-triangle-e',1);if(has_common(['Administrator','System Manager'],user_roles)){var savebtn=this.page_head.add_button('Save',function(){if(me.cur_rb)me.cur_rb.save_criteria();},0,'ui-icon-disk');var fn=function(){if(me.cur_rb){if(!me.cur_rb.current_loaded){msgprint("error:You must save the report before you can set Advanced features");return;}
|
||||
loaddoc('Search Criteria',me.cur_rb.sc_dict[me.cur_rb.current_loaded]);}};var advancedbtn=this.page_head.add_button('Advanced Settings',fn);}
|
||||
var page=wn.container.add_page("Report Builder");this.wrapper=$a(page,'div','layout-wrapper',{padding:'0px'});this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.append('<span class="report-title">');this.rb_area=$a(this.wrapper,'div','',{padding:'15px'});var me=this;this.rb_dict={};var run_fn=function(){if(me.cur_rb){me.cur_rb.dt.start_rec=1;me.cur_rb.dt.run();}}
|
||||
var runbtn=this.appframe.add_button('Run',run_fn,'icon-refresh');this.appframe.add_button('Export',function(){me.cur_rb&&me.cur_rb.dt.do_export();},'icon-download-alt');this.appframe.add_button('Print',function(){me.cur_rb&&me.cur_rb.dt.do_print();},'icon-print');this.appframe.add_button('Calc',function(){me.cur_rb&&me.cur_rb.dt.do_calc();},'icon-plus');if(has_common(['Administrator','System Manager'],user_roles)){var savebtn=this.appframe.add_button('Save',function(){if(me.cur_rb)me.cur_rb.save_criteria();});var fn=function(){if(me.cur_rb){if(!me.cur_rb.current_loaded){msgprint("error:You must save the report before you can set Advanced features");return;}
|
||||
loaddoc('Search Criteria',me.cur_rb.sc_dict[me.cur_rb.current_loaded]);}};var advancedbtn=this.appframe.add_button('Advanced Settings',fn,'icon-cog');}
|
||||
this.set_dt=function(dt,onload){my_onload=function(f){if(!f.forbidden){me.cur_rb=f;me.cur_rb.mytabs.items['Result'].expand();if(onload)onload(f);}}
|
||||
if(me.cur_rb)
|
||||
me.cur_rb.hide();if(me.rb_dict[dt]){me.rb_dict[dt].show(my_onload);}else{me.rb_dict[dt]=new _r.ReportBuilder(me.rb_area,dt,my_onload);}}}
|
||||
|
|
@ -28,7 +28,7 @@ _r.ReportBuilder.prototype.run=function(){this.dt.run();}
|
|||
_r.ReportBuilder.prototype.clear_criteria=function(){this.column_picker.clear();this.column_picker.set_defaults();for(var i=0;i<this.filter_fields.length;i++){this.filter_fields[i].df.filter_hide=0;this.filter_fields[i].df.ignore=0;if(this.filter_fields[i].is_custom){this.filter_fields[i].df.filter_hide=1;this.filter_fields[i].df.ignore=1;}
|
||||
this.filter_fields[i].set_input(null);}
|
||||
this.set_sort_options();this.set_main_title('Report: '+get_doctype_label(this.doctype));this.current_loaded=null;this.customized_filters=null;this.sc=null;this.has_index=1;this.has_headings=1;for(var i in this.fn_list)this[this.fn_list[i]]=null;}
|
||||
_r.ReportBuilder.prototype.set_main_title=function(t,t1){_r.rb_con.page_head.main_head.innerHTML=t;_r.rb_con.page_head.sub_head.innerHTML=(t1?t1:'');set_title(t);}
|
||||
_r.ReportBuilder.prototype.set_main_title=function(t,t1){var title=t+(t1?t1:'');_r.rb_con.appframe.$titlebar.find('.report-title').html(title);set_title(title);}
|
||||
_r.ReportBuilder.prototype.select_column=function(dt,label,value){if(value==null)value=1;this.column_picker.set(dt,label,value);}
|
||||
_r.ReportBuilder.prototype.set_filter=function(dt,label,value){if(this.filter_fields_dict[dt+'\1'+label])
|
||||
this.filter_fields_dict[dt+'\1'+label].set_input(value);}
|
||||
|
|
@ -160,8 +160,7 @@ if(!hide_toolbar)this.make_toolbar(parent);this.wrapper=$a(parent,'div','report_
|
|||
this.hwrapper=$a(this.wrapper,'div','report_head_wrapper');this.twrapper=$a(this.wrapper,'div','report_tab_wrapper');this.no_data_tag=$a(this.wrapper,'div','report_no_data');this.no_data_tag.innerHTML='No Records Found';this.fetching_tag=$a(this.wrapper,'div','',{height:'100%',background:'url("lib/images/ui/square_loading.gif") center no-repeat',display:'none'});}
|
||||
_r.DataTable.prototype.add_icon=function(parent,imgsrc){var i=$a(parent,'img');i.style.padding='2px';i.style.cursor='pointer';i.setAttribute('src','lib/images/icons/'+imgsrc+'.gif');return i;}
|
||||
_r.DataTable.prototype.set_no_limit=function(v){if(v){this.no_limit=1;$dh(this.page_len_sel.wrapper);}else{this.no_limit=0;$ds(this.page_len_sel.wrapper);}}
|
||||
_r.DataTable.prototype.make_toolbar=function(parent){var me=this;this.hbar=$a(parent,'div','',{margin:'8px 0px 16px 0px'});var ht=make_table(this.hbar,1,3,'100%',['40%','40%','20%'],{verticalAlign:'middle'});var div=$a($td(ht,0,0),'div');var make_btn=function(label,icon,onclick,bold){var btn=$btn(div,label,onclick);if(bold)$y(btn,{fontWeight:'bold'});}
|
||||
make_btn('Refresh','ui-icon-refresh',function(){me.start_rec=1;me.run();},1);make_btn('Export','ui-icon-circle-arrow-e',function(){me.do_export();});make_btn('Print','ui-icon-print',function(){me.do_print();});make_btn('Calc','ui-icon-calculator',function(){me.do_calc();});var t=make_table($td(ht,0,1),1,6,null,[null,null,null,'20px',null,null],{verticalAlign:'middle'});$td(t,0,0).innerHTML='Sort By:';$y($td(t,0,1),{textAlign:'right',paddingRight:'4px'});this.sort_sel=$a($td(t,0,2),'select','',{width:'100px'});this.sort_sel.onchange=function(){me.start_rec=1;me.run();}
|
||||
_r.DataTable.prototype.make_toolbar=function(parent){var me=this;this.hbar=$a(parent,'div','',{margin:'8px 0px 16px 0px'});var ht=make_table(this.hbar,1,3,'100%',['40%','40%','20%'],{verticalAlign:'middle'});var div=$a($td(ht,0,0),'div');var t=make_table($td(ht,0,1),1,6,null,[null,null,null,'20px',null,null],{verticalAlign:'middle'});$td(t,0,0).innerHTML='Sort By:';$y($td(t,0,1),{textAlign:'right',paddingRight:'4px'});this.sort_sel=$a($td(t,0,2),'select','',{width:'100px'});this.sort_sel.onchange=function(){me.start_rec=1;me.run();}
|
||||
this.sort_icon=this.add_icon($td(t,0,3),'arrow_down');this.sort_order='DESC';this.sort_icon.onclick=function(){if(me.sort_order=='ASC')me.set_desc();else me.set_asc();me.start_rec=1;me.run();}
|
||||
$td(t,0,4).innerHTML='Per Page:';$y($td(t,0,4),{textAlign:'right',paddingRight:'4px'});var s=new SelectWidget($td(t,0,5),['50','100','500','1000'],'70px');s.inp.value='50';s.inp.onchange=function(){me.page_len=flt(this.value);}
|
||||
this.page_len_sel=s;var c1=$td(ht,0,2);c1.style.textAlign='right';var ic=this.add_icon(c1,'resultset_first');ic.onclick=function(){me.start_rec=1;me.run();}
|
||||
|
|
|
|||
|
|
@ -167,11 +167,9 @@ _f.Frm.prototype.setup_std_layout = function() {
|
|||
|
||||
|
||||
// header - no headers for tables and guests
|
||||
if(!(this.meta.istable || user=='Guest')) this.frm_head = new _f.FrmHeader(this.page_layout.head, this);
|
||||
|
||||
// hide close btn for dialog rendering
|
||||
if(this.frm_head && this.meta.in_dialog) $dh(this.frm_head.page_head.close_btn);
|
||||
|
||||
if(!(this.meta.istable || user=='Guest' || this.meta.in_dialog))
|
||||
this.frm_head = new _f.FrmHeader(this.page_layout.head, this);
|
||||
|
||||
// bg colour
|
||||
if(this.meta.colour)
|
||||
this.layout.wrapper.style.backgroundColor = '#'+this.meta.colour.split(':')[1];
|
||||
|
|
@ -260,14 +258,6 @@ _f.Frm.prototype.rename_notify = function(dt, old, name) {
|
|||
this.opendocs[name] = true;
|
||||
}
|
||||
|
||||
// refresh the heading labels
|
||||
// ======================================================================================
|
||||
|
||||
_f.Frm.prototype.set_heading = function() {
|
||||
if(!this.meta.istable && this.frm_head) this.frm_head.refresh_labels(this);
|
||||
}
|
||||
|
||||
|
||||
// SETUP
|
||||
// ======================================================================================
|
||||
|
||||
|
|
@ -362,7 +352,7 @@ _f.Frm.prototype.setup_fields_std = function() {
|
|||
|
||||
// --------------------------------------------------------------------------------------
|
||||
_f.Frm.prototype.add_custom_button = function(label, fn, icon) {
|
||||
this.frm_head.page_head.add_button(label, fn, 1);
|
||||
this.frm_head.add_button(label, fn, icon);
|
||||
}
|
||||
_f.Frm.prototype.clear_custom_buttons = function() {
|
||||
//
|
||||
|
|
@ -470,15 +460,16 @@ _f.Frm.prototype.refresh_header = function() {
|
|||
if(!this.meta.in_dialog) {
|
||||
set_title(this.meta.issingle ? this.doctype : this.docname);
|
||||
}
|
||||
|
||||
// form title
|
||||
this.page_layout.main_head.innerHTML = '<h2>'+this.docname+'</h2>';
|
||||
|
||||
// show / hide buttons
|
||||
if(this.frm_head)this.frm_head.refresh_toolbar();
|
||||
if(this.frm_head)this.frm_head.refresh();
|
||||
|
||||
// add to recent
|
||||
if(wn.ui.toolbar.recent) wn.ui.toolbar.recent.add(this.doctype, this.docname, 1);
|
||||
|
||||
// refresh_heading - status etc.
|
||||
this.set_heading();
|
||||
if(wn.ui.toolbar.recent)
|
||||
wn.ui.toolbar.recent.add(this.doctype, this.docname, 1);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
@ -1111,18 +1102,19 @@ _f.set_value = function(dt, dn, fn, v) {
|
|||
if(changed) {
|
||||
d[fn] = v;
|
||||
d.__unsaved = 1;
|
||||
var frm = wn.views.formview[d.doctype];
|
||||
var frm = wn.views.formview[d.doctype].frm;
|
||||
try {
|
||||
if(d.parent && d.parenttype) {
|
||||
locals[d.parenttype][d.parent].__unsaved = 1;
|
||||
frm = wn.views.formview[d.parenttype];
|
||||
frm = wn.views.formview[d.parenttype].frm;
|
||||
}
|
||||
} catch(e) {
|
||||
if(d.parent && d.parenttype)
|
||||
errprint('Setting __unsaved error:'+d.name+','+d.parent+','+d.parenttype);
|
||||
}
|
||||
if(frm && frm==cur_frm) {
|
||||
frm.set_heading();
|
||||
|
||||
if(frm && frm==cur_frm && frm.frm_head) {
|
||||
frm.frm_head.refresh_labels();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,21 +82,11 @@ _f.SectionBreak.prototype.make_body = function() {
|
|||
if(this.df.label) {
|
||||
if(!this.df.description)
|
||||
this.df.description = '';
|
||||
$(this.row.main_head).html(repl('<div class="form-section-head" style="cursor: pointer">\
|
||||
<div class="head">%(label)s</h3>\
|
||||
<div class="help small">%(description)s</div>\
|
||||
$(this.row.main_head).html(repl('<div class="form-section-head">\
|
||||
<h3 class="head">%(label)s</h3>\
|
||||
<div class="help small" \
|
||||
style="margin-top: 4px; margin-bottom: 8px;">%(description)s</div>\
|
||||
</div>', this.df));
|
||||
|
||||
this.$expand = $(this.row.main_head).find('.head').click(function() {
|
||||
if($(me.row.main_head).find('h3').length) {
|
||||
me.section_collapse();
|
||||
} else {
|
||||
me.section_expand();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
this.collapsible = true;
|
||||
} else {
|
||||
// simple
|
||||
$(this.wrapper).html('<div class="form-section-head"></div>');
|
||||
|
|
@ -163,11 +153,12 @@ _f.SectionBreak.prototype.refresh = function(from_form) {
|
|||
if(this.row)this.row.hide();
|
||||
} else {
|
||||
if(this.collapsible) {
|
||||
if(this.df.reqd || this.has_data()) {
|
||||
this.section_expand(from_form);
|
||||
} else {
|
||||
this.section_collapse();
|
||||
}
|
||||
//this.section_expand(from_form);
|
||||
//if(this.df.reqd || this.has_data()) {
|
||||
// this.section_expand(from_form);
|
||||
//} else {
|
||||
// this.section_collapse();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,100 @@
|
|||
// OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
// features
|
||||
// --------
|
||||
// toolbar - standard and custom
|
||||
// label - saved, submitted etc
|
||||
// breadcrumbs
|
||||
// save / submit button toggle based on "saved" or not
|
||||
// highlight and fade name based on refresh
|
||||
|
||||
_f.FrmHeader = Class.extend({
|
||||
init: function(parent, frm) {
|
||||
this.appframe = new wn.views.AppFrame(parent)
|
||||
this.appframe.$titlebar.append('<span class="label-area"></span>\
|
||||
<span class="breadcrumb-area"></span>');
|
||||
this.$w = this.appframe.$w;
|
||||
},
|
||||
refresh: function() {
|
||||
// refresh breadcrumbs
|
||||
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('<span class="label %(lab_class)s">\
|
||||
%(lab_status)s</span>', {
|
||||
lab_status: labinfo[0],
|
||||
lab_class: labinfo[1]
|
||||
}));
|
||||
},
|
||||
refresh_toolbar: function() {
|
||||
// clear
|
||||
this.appframe.clear_buttons();
|
||||
var p = cur_frm.get_doc_perms();
|
||||
|
||||
// Edit
|
||||
if(cur_frm.meta.read_only_onload && !cur_frm.doc.__islocal) {
|
||||
if(!cur_frm.editable)
|
||||
this.appframe.add_button('Edit', function() {
|
||||
cur_frm.edit_doc();
|
||||
},'icon-pencil');
|
||||
else
|
||||
this.appframe.add_button('Print View', function() {
|
||||
cur_frm.is_editable[cur_frm.docname] = 0;
|
||||
cur_frm.refresh(); }, 'icon-print' );
|
||||
}
|
||||
|
||||
var docstatus = cint(cur_frm.doc.docstatus);
|
||||
// Save
|
||||
if(docstatus==0 && p[WRITE]) {
|
||||
this.appframe.add_button('Save', function() { cur_frm.save('Save');}, '');
|
||||
this.appframe.buttons['Save'].addClass('btn-info');
|
||||
}
|
||||
// Submit
|
||||
if(docstatus==0 && p[SUBMIT] && (!cur_frm.doc.__islocal))
|
||||
this.appframe.add_button('Submit', function() { cur_frm.savesubmit();}, 'icon-lock');
|
||||
|
||||
// Update after sumit
|
||||
if(docstatus==1 && p[SUBMIT]) {
|
||||
this.appframe.add_button('Update', function() { cur_frm.savesubmit();}, '');
|
||||
if(!cur_frm.doc.__unsaved) this.appframe.buttons['Update'].toggle(false);
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if(docstatus==1 && p[CANCEL])
|
||||
this.appframe.add_button('Cancel', function() { cur_frm.savecancel() }, 'icon-remove');
|
||||
|
||||
// Amend
|
||||
if(docstatus==2 && p[AMEND])
|
||||
this.appframe.add_button('Amend', function() { cur_frm.amend_doc() }, 'icon-pencil');
|
||||
|
||||
},
|
||||
show: function() {
|
||||
},
|
||||
hide: function() {
|
||||
|
||||
},
|
||||
hide_close: function() {
|
||||
this.$w.find('.close').toggle(false);
|
||||
}
|
||||
})
|
||||
|
||||
/*
|
||||
_f.FrmHeader = function(parent, frm) {
|
||||
var me = this;
|
||||
this.wrapper = $a(parent, 'div');
|
||||
|
|
@ -229,3 +323,5 @@ _f.FrmHeader.prototype.refresh_labels = function(f) {
|
|||
setTimeout('$(cur_frm.frm_head.dn_area).addClass("background-fade-in")\
|
||||
.css("background-color", "white")', 1500)
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
@ -119,24 +119,6 @@ _r.DataTable.prototype.make_toolbar = function(parent) {
|
|||
var ht = make_table(this.hbar,1,3,'100%',['40%','40%','20%'],{verticalAlign:'middle'});
|
||||
var div = $a($td(ht,0,0), 'div');
|
||||
|
||||
var make_btn = function(label,icon,onclick,bold) {
|
||||
var btn = $btn(div,label,onclick);
|
||||
if(bold)$y(btn,{fontWeight: 'bold'});
|
||||
}
|
||||
|
||||
|
||||
// refresh btn
|
||||
make_btn('Refresh','ui-icon-refresh',function() { me.start_rec = 1; me.run();},1);
|
||||
|
||||
// export
|
||||
make_btn('Export','ui-icon-circle-arrow-e',function() {me.do_export();});
|
||||
|
||||
// print
|
||||
make_btn('Print','ui-icon-print',function() {me.do_print();});
|
||||
|
||||
// print
|
||||
make_btn('Calc','ui-icon-calculator',function() {me.do_calc();});
|
||||
|
||||
// sort select
|
||||
var t = make_table($td(ht,0,1),1,6,null,[null,null,null,'20px',null,null],{verticalAlign:'middle'});
|
||||
|
||||
|
|
|
|||
|
|
@ -30,18 +30,15 @@ _r.ReportContainer = function() {
|
|||
msgprint("Not Allowed");
|
||||
return;
|
||||
}
|
||||
this.wrapper = $a(wn.container.add_page("Report Builder"), 'div', 'layout-wrapper');
|
||||
var head_div = $a(this.wrapper, 'div');
|
||||
this.rb_area = $a(this.wrapper, 'div');
|
||||
var page = wn.container.add_page("Report Builder");
|
||||
this.wrapper = $a(page, 'div', 'layout-wrapper', {padding: '0px'});
|
||||
this.appframe = new wn.views.AppFrame(this.wrapper);
|
||||
this.appframe.$titlebar.append('<span class="report-title">');
|
||||
this.rb_area = $a(this.wrapper, 'div', '', {padding: '15px'});
|
||||
|
||||
var me = this;
|
||||
this.rb_dict = {};
|
||||
|
||||
// tool bar
|
||||
this.page_head = new PageHeader(head_div);
|
||||
$y(this.page_head.wrapper, {marginBottom:'0px'});
|
||||
|
||||
// buttons
|
||||
|
||||
var run_fn = function() {
|
||||
if(me.cur_rb){
|
||||
|
|
@ -50,13 +47,22 @@ _r.ReportContainer = function() {
|
|||
}
|
||||
}
|
||||
|
||||
var runbtn = this.page_head.add_button('Run', run_fn, 1, 'ui-icon-circle-triangle-e', 1);
|
||||
var runbtn = this.appframe.add_button('Run', run_fn, 'icon-refresh');
|
||||
|
||||
// refresh btn
|
||||
this.appframe.add_button('Export', function() { me.cur_rb && me.cur_rb.dt.do_export(); },
|
||||
'icon-download-alt');
|
||||
this.appframe.add_button('Print', function() { me.cur_rb && me.cur_rb.dt.do_print(); },
|
||||
'icon-print');
|
||||
this.appframe.add_button('Calc', function() { me.cur_rb && me.cur_rb.dt.do_calc(); },
|
||||
'icon-plus');
|
||||
|
||||
// new
|
||||
if(has_common(['Administrator', 'System Manager'], user_roles)) {
|
||||
// save
|
||||
|
||||
var savebtn = this.page_head.add_button('Save', function() {if(me.cur_rb) me.cur_rb.save_criteria(); }, 0, 'ui-icon-disk');
|
||||
var savebtn = this.appframe.add_button('Save',
|
||||
function() {if(me.cur_rb) me.cur_rb.save_criteria(); });
|
||||
|
||||
// advanced
|
||||
var fn = function() {
|
||||
|
|
@ -68,7 +74,7 @@ _r.ReportContainer = function() {
|
|||
loaddoc('Search Criteria', me.cur_rb.sc_dict[me.cur_rb.current_loaded]);
|
||||
}
|
||||
};
|
||||
var advancedbtn = this.page_head.add_button('Advanced Settings', fn);
|
||||
var advancedbtn = this.appframe.add_button('Advanced Settings', fn, 'icon-cog');
|
||||
}
|
||||
|
||||
// set a type
|
||||
|
|
@ -300,9 +306,9 @@ _r.ReportBuilder.prototype.clear_criteria = function() {
|
|||
// -------------------------------------------------------------------------------------
|
||||
|
||||
_r.ReportBuilder.prototype.set_main_title = function(t, t1) {
|
||||
_r.rb_con.page_head.main_head.innerHTML = t;
|
||||
_r.rb_con.page_head.sub_head.innerHTML = (t1 ? t1 : '');
|
||||
set_title(t);
|
||||
var title = t + (t1 ? t1 : '');
|
||||
_r.rb_con.appframe.$titlebar.find('.report-title').html(title);
|
||||
set_title(title);
|
||||
}
|
||||
|
||||
_r.ReportBuilder.prototype.select_column = function(dt, label, value) {
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@
|
|||
wn.PageLayout = function(args) {
|
||||
$.extend(this, args)
|
||||
this.wrapper = $a(this.parent, 'div', 'layout-wrapper layout-wrapper-background');
|
||||
this.head = $a(this.wrapper, 'div');
|
||||
this.main = $a(this.wrapper, 'div', 'layout-main-section');
|
||||
this.sidebar_area = $a(this.wrapper, 'div', 'layout-side-section');
|
||||
$a(this.wrapper, 'div', '', {clear:'both'});
|
||||
this.head = $a(this.main, 'div');
|
||||
this.toolbar_area = $a(this.main, 'div');
|
||||
this.main_head = $a(this.main, 'div', 'form-title');
|
||||
this.body = $a(this.main, 'div');
|
||||
this.footer = $a(this.main, 'div');
|
||||
if(this.heading) {
|
||||
|
|
|
|||
32
js/wn/views/appframe.js
Normal file
32
js/wn/views/appframe.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
wn.views.AppFrame = Class.extend({
|
||||
init: function(parent) {
|
||||
this.buttons = {};
|
||||
this.$w = $('<div></div>').appendTo(parent);
|
||||
|
||||
this.$titlebar = $('<div class="appframe-titlebar">\
|
||||
<span class="close">×</span>\
|
||||
</div>').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('<div class="appframe-toolbar"></div>');
|
||||
|
||||
args = { label: label, icon:'' };
|
||||
if(icon) {
|
||||
args.icon = '<i class="'+icon+'"></i>';
|
||||
}
|
||||
this.buttons[label] = $(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>', args))
|
||||
.click(click)
|
||||
.appendTo(this.$w.find('.appframe-toolbar'));
|
||||
|
||||
},
|
||||
clear_buttons: function() {
|
||||
this.$w.find('.appframe-toolbar').empty();
|
||||
}
|
||||
})
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
wn.provide('wn.views');
|
||||
wn.views.breadcrumbs = function(parent, module, doctype, name) {
|
||||
$(parent).empty();
|
||||
var $bspan = $(repl('<span class="breadcrumbs">\
|
||||
<a href="#%(home_page)s">Home</a></span>', {home_page: wn.boot.home_page}));
|
||||
if(module) {
|
||||
|
|
@ -7,11 +8,11 @@ wn.views.breadcrumbs = function(parent, module, doctype, name) {
|
|||
{module: module, module_small: module.toLowerCase() }))
|
||||
}
|
||||
if(doctype && (locals.DocType[doctype] && !locals.DocType[doctype].issingle)) {
|
||||
$bspan.append(repl(' / <a href="#!List/%(doctype)s">%(doctype)s List</a>',
|
||||
$bspan.append(repl(' / <a href="#!List/%(doctype)s">%(doctype)s</a>',
|
||||
{doctype: doctype}))
|
||||
}
|
||||
if(name) {
|
||||
$bspan.append(' / ' + name)
|
||||
$bspan.append(' / ' + name.bold())
|
||||
}
|
||||
$bspan.appendTo(parent);
|
||||
}
|
||||
|
|
@ -54,9 +54,8 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
make_page: function() {
|
||||
var me = this;
|
||||
this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="appframe-area"></div>\
|
||||
<div class="layout-main-section">\
|
||||
<a class="close" onclick="window.history.back();">×</a>\
|
||||
<div class="breadcrumbs-area"></div>\
|
||||
<h1>%(label)s</h1>\
|
||||
<hr>\
|
||||
<div class="wnlist-area"><div class="help">Loading...</div></div>\
|
||||
|
|
@ -72,7 +71,8 @@ wn.views.DocListView = wn.ui.Listing.extend({
|
|||
<div style="clear: both"></div>\
|
||||
</div>', {label: this.label}));
|
||||
|
||||
wn.views.breadcrumbs(this.$page.find('.breadcrumbs-area').get(0), locals.DocType[this.doctype].module);
|
||||
this.appframe = new wn.views.AppFrame(this.$page.find('.appframe-area'));
|
||||
wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar), locals.DocType[this.doctype].module);
|
||||
},
|
||||
|
||||
setup: function() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue