Merge branch 'dev' of github.com:webnotes/wnframework into dev

This commit is contained in:
Anand Doshi 2012-07-11 12:09:47 +05:30
commit 96f245e9df
12 changed files with 121 additions and 127 deletions

View file

@ -135,7 +135,7 @@ div.fix_ff_cursor { overflow: auto; }
div.comment { color: #444; }
.small {
font-size: 11px;
font-size: 12px;
}
.help {

View file

@ -24,6 +24,10 @@
.input_area input, select, textarea {
font-size: 14px;
padding: 2px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.input_area input {
@ -41,9 +45,16 @@
width: 80%;
padding: 2px 0px;
font-size: 12px;
background-color: #eee;
padding: 2px;
border: 1px solid #ddd;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.disp_area_no_val {
height: 14px;
min-height: 14px;
}
.no_img {

View file

@ -12,6 +12,11 @@ div.form-title {
margin-right: 7px;
}
div.form-intro-area {
padding: 9px 9px 0px 9px;
margin: 0px 0px 15px 0px;
}
div.form-section-head {
margin: 11px -15px 3px -15px;
border-top: 1px solid #ccc;
@ -21,7 +26,7 @@ div.form-section-head {
div.form-layout-row:first-child .form-section-head {
border-top: 0px solid #ccc !important;
margin-top: 0px;
padding-top: 15px;
padding-top: 0px;
}
div.form-section-head h3 {
@ -48,18 +53,6 @@ div.page_break {
border-top: 1px dashed #888;
}
div.grid_tbarlinks {
border-bottom: 0px;
background-color: #CCC;
padding: 4px 4px 2px 4px;
width: 190px;
float: right;
-moz-border-radius-topleft: 5px; -moz-border-radius-topright: 5px;
-webkit-border-top-left-radius: 5px; -webkit-border-top-right-radius: 5px;
}
div.dialog_frm {
position: relative;
margin: 10px;

View file

@ -1,46 +1,36 @@
/* Grid */
/* --- Simple --- */
.grid_wrapper_simple {
width: 100%;
margin-bottom: 8px;
border: 1px solid #AA9;
}
.grid_head_wrapper_simple {
padding: 0px;
border-bottom: 2px solid #AAA;
}
.grid_head_wrapper_simple td {
border-right: 1px solid #AA9;
}
.grid_head_wrapper_simple td div {
padding: 2px;
}
.grid_tab_wrapper_simple {
}
.grid_cell_simple {
padding: 2px;
background-color: #fff;
border-right: 1px solid #AA9;
}
/* --- Normal --- */
.grid_wrapper {
position: relative;
overflow: auto;
border: 1px solid #AAA;
width: 100%;
margin-bottom: 8px;
background-color: #fff;
background-color: #f8f8f8;
}
div.grid_tbarlinks {
border-bottom: 0px;
padding: 4px 4px 2px 4px;
width: 190px;
float: right;
margin-right: 12px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
background: #dddddd; /* Old browsers */
background: -moz-linear-gradient(top, #dddddd 0%, #bbbbbb 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dddddd), color-stop(100%,#bbbbbb)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #dddddd 0%,#bbbbbb 100%); /* IE10+ */
background: linear-gradient(to bottom, #dddddd 0%,#bbbbbb 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#bbbbbb',GradientType=0 ); /* IE6-9 */
}
.grid_tab_wrapper {
@ -71,11 +61,19 @@
}
.grid_head_table td {
background-color: #EEE;
border-right: 1px solid #AAA;
border-bottom: 1px solid #AAA;
height: 40px;
padding: 0px;
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(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}
.grid_head_table td div {

View file

@ -30,20 +30,9 @@ div.notice {
}
.help_box, .help-box {
background-color:#FFC;
font-size: 13px;
color: #864;
padding: 7px;
background-color: #ffe;
color: #874;
padding: 9px 9px 9px 9px;
border: 1px dashed #fc7;
margin: 11px 0px;
border: 1px solid #EEB;
}
.help_box_big {
background-color:#FFC;
color: #864;
padding: 7px;
margin: 7px 0px;
border: 1px solid #EEB;
text-align: center;
font-size: 14px;
}

View file

@ -38,10 +38,10 @@ function makeselector() {
var d = new Dialog(540,440, 'Search');
d.make_body([
['HTML', 'Help'],
['Data', 'Beginning With', 'Tip: You can use wildcard "%"'],
['Select', 'Search By'],
['Button', 'Search'],
['HTML', 'Help'],
['HTML', 'Result']
]);
@ -64,7 +64,8 @@ function makeselector() {
d.set_query_description()
if(!d.sel_type)d.sel_type = 'Value';
d.set_title('Select a "'+ d.sel_type +'" for field "'+label+'"');
d.set_title("Select");
d.set_query_description('Select a "'+ d.sel_type +'" for field "'+label+'"');
}
d.set_search = function(dt) {
if(d.style!='Search') {
@ -83,9 +84,10 @@ function makeselector() {
}
})
d.set_query_description = function() {
if(d.input && d.input.query_description) {
d.rows['Help'].innerHTML ='<div class="help_box">' + d.input.query_description + '</div>';
d.set_query_description = function(txt) {
if(!txt) txt = d.input && d.input.query_description || null;
if(txt) {
d.rows['Help'].innerHTML ='<div class="help-box" style="margin-top:0px">' + txt + '</div>';
} else {
d.rows['Help'].innerHTML =''
}

View file

@ -134,7 +134,7 @@ hide_field = function(n) {
else { console.log("hide_field cannot find field " + n); }
}
if(cur_frm) {
if(n.substr) _hide_field(n,1);
if(typeof n == 'string') _hide_field(n,1);
else { for(var i in n)_hide_field(n[i],1) }
}
}
@ -146,7 +146,7 @@ unhide_field = function(n) {
else { console.log("unhide_field cannot find field " + n); }
}
if(cur_frm) {
if(n.substr) _hide_field(n,0);
if(typeof n == 'string') _hide_field(n,0);
else { for(var i in n)_hide_field(n[i],0) }
}
}

View file

@ -26,7 +26,7 @@
+ this.wrapper
+ this.content
+ this.saved_wrapper
+ wn.PageLayout (this.page_layout_layout)
+ wn.PageLayout (this.page_layout)
+ this.wrapper
+ this.wtab (table)
+ this.main
@ -210,8 +210,7 @@ _f.Frm.prototype.print_doc = function() {
_p.show_dialog(); // multiple options
}
// ======================================================================================
// email the form
_f.Frm.prototype.email_doc = function() {
// make selector
if(!_e.dialog) _e.make();
@ -245,8 +244,7 @@ _f.Frm.prototype.email_doc = function() {
_e.dialog.show();
}
// ======================================================================================
// notify this form of renamed records
_f.Frm.prototype.rename_notify = function(dt, old, name) {
// from form
if(this.meta.in_dialog && !this.in_form)
@ -276,8 +274,6 @@ _f.Frm.prototype.rename_notify = function(dt, old, name) {
}
// SETUP
// ======================================================================================
_f.Frm.prototype.setup_meta = function(doctype) {
this.meta = get_local('DocType',this.doctype);
@ -287,13 +283,11 @@ _f.Frm.prototype.setup_meta = function(doctype) {
}
// --------------------------------------------------------------------------------------
_f.Frm.prototype.setup_sidebar = function() {
this.sidebar = new wn.widgets.form.sidebar.Sidebar(this);
}
// --------------------------------------------------------------------------------------
_f.Frm.prototype.setup_footer = function() {
var me = this;
@ -318,7 +312,19 @@ _f.Frm.prototype.setup_footer = function() {
}
}
// --------------------------------------------------------------------------------------
_f.Frm.prototype.set_intro = function(txt) {
if(!this.intro_area) {
this.intro_area = $('<div class="help-box form-intro-area">')
.insertBefore(this.page_layout.body.firstChild);
}
if(txt) {
this.intro_area.html(txt);
} else {
this.intro_area.remove();
this.intro_area = null;
}
}
_f.Frm.prototype.setup_fields_std = function() {
var fl = wn.meta.docfield_list[this.doctype];
@ -624,8 +630,6 @@ _f.Frm.prototype.refresh_footer = function() {
}
}
// --------------------------------------------------------------------------------------
_f.Frm.prototype.refresh_fields = function() {
// refresh fields
for(var i=0; i<this.fields.length; i++) {
@ -653,7 +657,6 @@ _f.Frm.prototype.refresh_fields = function() {
this.cleanup_refresh(this);
}
// --------------------------------------------------------------------------------------
_f.Frm.prototype.cleanup_refresh = function() {
var me = this;
@ -680,7 +683,6 @@ _f.Frm.prototype.cleanup_refresh = function() {
}
// Resolve "depends_on" and show / hide accordingly
// ======================================================================================
_f.Frm.prototype.refresh_dependency = function() {
var me = this;
@ -866,7 +868,6 @@ _f.Frm.prototype.save = function(save_action, call_back) {
}
}
// ======================================================================================
_f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) {
var me = this;
@ -898,8 +899,6 @@ _f.Frm.prototype.runscript = function(scriptname, callingfield, onrefresh) {
}
// ======================================================================================
_f.Frm.prototype.runclientscript = function(caller, cdt, cdn) {
var _dt = this.parent_doctype ? this.parent_doctype : this.doctype;
var _dn = this.parent_docname ? this.parent_docname : this.docname;
@ -948,8 +947,6 @@ _f.Frm.prototype.runclientscript = function(caller, cdt, cdn) {
return ret;
}
// ======================================================================================
_f.Frm.prototype.copy_doc = function(onload, from_amend) {
if(!this.perm[0][CREATE]) {
@ -1002,8 +999,6 @@ _f.Frm.prototype.copy_doc = function(onload, from_amend) {
loaddoc(newdoc.doctype, newdoc.name);
}
// ======================================================================================
_f.Frm.prototype.reload_doc = function() {
this.check_doctype_conflict(this.docname);
@ -1023,7 +1018,6 @@ _f.Frm.prototype.reload_doc = function() {
}
}
// ======================================================================================
_f.Frm.prototype.savedoc = function(save_action, onsave, onerr) {
this.error_in_section = 0;
@ -1071,8 +1065,6 @@ _f.Frm.prototype.savetrash = function() {
}
}
// ======================================================================================
_f.Frm.prototype.amend_doc = function() {
if(!this.fields_dict['amended_from']) {
alert('"amended_from" field must be present to do an amendment.');
@ -1087,8 +1079,6 @@ _f.Frm.prototype.amend_doc = function() {
this.copy_doc(fn, 1);
}
// ======================================================================================
_f.get_value = function(dt, dn, fn) {
if(locals[dt] && locals[dt][dn])
return locals[dt][dn][fn];
@ -1129,8 +1119,6 @@ _f.set_value = function(dt, dn, fn, v) {
}
}
// ======================================================================================
_f.Frm.prototype.show_comments = function() {
if(!cur_frm.comments) {
cur_frm.comments = new Dialog(540, 400, 'Comments');
@ -1144,3 +1132,15 @@ _f.Frm.prototype.show_comments = function() {
cur_frm.comments.list.run();
}
_f.Frm.prototype.get_doc = function() {
return locals[this.doctype][this.docname];
}
_f.Frm.prototype.get_doclist = function() {
return make_doclist(this.doctype, this.docname);
}
_f.Frm.prototype.toggle_fields = function(fields, show) {
if(show) { unhide_field(fields) }
else { hide_field(fields) }
}

View file

@ -235,13 +235,14 @@ _f.TableField.prototype = new Field();
_f.TableField.prototype.with_label = 0;
_f.TableField.prototype.make_body = function() {
if(this.perm[this.df.permlevel] && this.perm[this.df.permlevel][READ]) {
// add comment area
if(this.df.description) {
this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description)
}
this.grid = new _f.FormGrid(this);
if(this.frm)this.frm.grids[this.frm.grids.length] = this;
this.grid.make_buttons();
// description
if(this.df.description) {
this.desc_area = $a(this.parent, 'div', 'help small', '', this.df.description)
}
}
}

View file

@ -42,6 +42,22 @@ _f.FormGrid.prototype.setup = function() {
this.make_columns();
}
_f.FormGrid.prototype.make_buttons = function() {
var me = this;
this.tbar_btns = {};
this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),'Del',
function() { me.delete_row(); }, 'icon-remove-sign');
this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),'Ins',
function() { me.insert_row(); }, 'icon-plus');
this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),'Up',
function() { me.move_row(true); }, 'icon-arrow-up');
this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),'Dn',
function() { me.move_row(false); }, 'icon-arrow-down');
for(var i in this.btns)
this.btns[i].isactive = true;
}
_f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) {
var div = $a(parent,'div','',{cursor:'pointer'});
@ -66,22 +82,6 @@ _f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) {
return div;
}
_f.FormGrid.prototype.make_buttons = function() {
var me = this;
this.tbar_btns = {};
this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),'Del',
function() { me.delete_row(); }, 'icon-remove-sign');
this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),'Ins',
function() { me.insert_row(); }, 'icon-plus');
this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),'Up',
function() { me.move_row(true); }, 'icon-arrow-up');
this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),'Dn',
function() { me.move_row(false); }, 'icon-arrow-down');
for(var i in this.btns)
this.btns[i].isactive = true;
}
_f.FormGrid.prototype.make_columns = function() {
var gl = wn.meta.docfield_list[this.field.df.options];
@ -234,7 +234,7 @@ _f.FormGrid.prototype.delete_row = function(dt, dn) {
LocalDB.delete_record(this.doctype, r.docname);
this.refresh();
if(ri < (this.tab.rows.length-2))
if(ri < (this.tab.rows.length-1))
this.cell_select(null, ri, ci);
else _f.cur_grid_cell = null;
}

View file

@ -54,13 +54,13 @@ _f.Grid.prototype.init = function(parent, row_height) {
_f.Grid.prototype.make_ui = function(parent) {
var ht = make_table($a(parent, 'div'), 1, 2, '100%', ['60%','40%']);
var ht = make_table($a(parent, 'div'), 1, 2, '100%', ['55%','45%']);
this.main_title = $td(ht,0,0); this.main_title.className = 'columnHeading';
$td(ht,0,1).style.textAlign = 'right';
this.tbar_div = $a($td(ht,0,1), 'div', 'grid_tbarlinks');
this.tbar_tab = make_table(this.tbar_div,1,4,'100%',['25%','25%','25%','25%']);
this.wrapper = $a(parent, 'div', 'grid_wrapper');
this.wrapper = $a(parent, 'div', 'grid_wrapper round');
this.head_wrapper = $a(this.wrapper, 'div', 'grid_head_wrapper');
@ -296,7 +296,7 @@ _f.Grid.prototype.cell_deselect = function() {
}
_f.Grid.prototype.cell_select = function(cell, ri, ci) {
if(_f.cur_grid_cell==cell && cell.hc) return;
if(cell && _f.cur_grid_cell==cell && cell.hc) return;
if(ri!=null && ci!=null)
cell = this.tab.rows[ri].cells[ci];

View file

@ -24,7 +24,7 @@ wn.ui.AppFrame = Class.extend({
args = { label: label, icon:'' };
if(icon) {
args.icon = '<i class="'+icon+'"></i>';
args.icon = '<i class="icon '+icon+'"></i>';
}
this.buttons[label] = $(repl('<button class="btn btn-small">\
%(icon)s %(label)s</button>', args))