PDA

View Full Version : JS Lint



mjhaston
20 Nov 2011, 9:28 AM
I'm not being lazy. I'm trying to find my issue, probably syntax, in this code for a while now ... using a few LINT type validators. I'm developing this in Spket IDE.

The application works in Firefox, Chrome, Safari .... in IE9 it renders and then the tree is useless. Clicking does nothing and no errors in the console! The LINT validators talk about extra semicolon, but every one I check is a match to the start of the statement.

Would anyone have a few minutes to validate this and tell me where my issue is? With IE its usually a lot easier to find an extra , or ;


TIA.





Ext.ns('visitation-module');

Ext.BLANK__URL = '../resources/images/default/s.gif';
//Ext.chart.Chart.CHART_URL = '../resources/charts.swf';

Ext.onReady(function() {

var today = new Date();
today.setDate(today.getDate());

Ext.override(Ext.form.RadioGroup, {
isDirty : function() {
if (this.originalValue == undefined) {
return false;
}
if (this.originalValue.inputValue == this.getValue().inputValue) {
return false;
}
return true;
}
});

// Ext.override(Ext.form.Checkbox, {
// isDirty : function() {
// if (this.originalValue == undefined) {
// return false;
// }
// if (this.originalValue.inputValue == this.getValue().inputValue) {
// return false;
// }
// return true;
// }
// });

Ext.override(Ext.chart.Chart, {
onDestroy : function() {
Ext.chart.Chart.superclass.onDestroy.call(this);
this.bindStore(null);
var tip = this.tipFnName;
if (!Ext.isEmpty(tip)) {
delete window[tip];
}
}
});

Ext.override(Ext.CompositeElement, {
getTextWidth : function() {
var i, e, els = this.elements, result = 0;
for (i = 0; e = Ext.get(els[i]); i++) {
result = Math.max(result, e.getTextWidth.apply(e,
arguments));
}
return result;
}
});

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';

Ext.override(Ext.form.Field, {
afterRender : Ext.form.Field.prototype.afterRender.createSequence(function() {
var qt = this.qtip;
if (qt) {
Ext.QuickTips.register({
target : this,
title : '',
text : qt,
enabled : true,
showDelay : 20
});
}
})
});

Ext.apply(Ext.form.VTypes, {
daterange : function(val, field) {
var date = field.parseDate(val);

if (!date) {
return false;
}
if (field.startDateField) {
var start = Ext.getCmp(field.startDateField);
if (!start.maxValue || (date.getTime() != start.maxValue.getTime())) {
start.setMaxValue(date);
start.validate();
}
} else if (field.endDateField) {
var end = Ext.getCmp(field.endDateField);
if (!end.minValue || (date.getTime() != end.minValue.getTime())) {
end.setMinValue(date);
end.validate();
}
}
/*
* Always return true since we're only using this vtype to set the
* min/max allowed values (these are tested for after the vtype
* test)
*/
return true;
},

password : function(val, field) {
if (field.initialPassField) {
var pwd = Ext.getCmp(field.initialPassField);
return (val == pwd.getValue());
}
return true;
},

testValidation : function(v) {
return false;
},

testUserid : function(v) {
return (v != 'USERID');
},
testUseridName : function(v) {
return (v != ' ');
},
testUserEmail : function(v) {
return (v != ' ');
},
testVisit : function(v) {
var visit = detailsForm.getForm().findField('visit-type').getValue();
var visitDate = detailsForm.getForm().findField('date-of-visit').getValue();
if (visit == '' && visitDate != '' || visit != '' & visitDate == '') {
return false;
}
},

passwordText : 'Passwords do not match'
});

function viewOptions(view) {

visitationStore.load({
params : {
state : filtersForm.getForm().findField('state').getValue(),
ssn : filtersForm.getForm().findField('combo-ssn').getValue(),
zips : filtersForm.getForm().findField('zips').getValue(),
format : 'JSON',
dummy : 'function_viewOptions',
view : view,
userid : userid
}
});
filtersForm.getForm().findField('hiddenView').setValue(view);

};

function submitJob(mode) {

var sm = visitationGrid.getSelectionModel().getSelections();

if (rowCount > 0) {

var selections = visitationGrid.getSelectionModel().getSelections();
var temp = '';
var addedNote = '';
for (i = 0; i <= sm.length - 1; i++) {

var myDate = new Date(sm[i].get('visit-date'));
var myDateYear = myDate.getFullYear();
var currentDate = new Date();
var currentYear = currentDate.getFullYear();
if (mode == 'REPORT') {
if (myDateYear == currentYear) {
temp = temp + '|' + sm[i].get('ssn');
} else {
addedNote = 'Only available reports sent.';
}
} else {
temp = temp + '|' + sm[i].get('ssn');
}

}

var body = Ext.getBody();
var myForm = body.createChild({
tag : 'form',
cls : 'x-hidden',
id : 'hidden_form',
method : 'post',
target : '_blank'
});

Ext.Ajax.request({
url : '/cgidev2p/jsonStr014.pgm',
form : myForm,
method : 'POST',
waitMsg : 'Job running ...',
params : 'batch_ssn=' + temp + '&batch_format=DOC' + '&batch_mode=' + mode + '&emailTo='
+ emailForm.getForm().findField('emailTo').getValue()
+ '&subject=' + emailForm.getForm().findField('subject').getValue()
+ '&msg=' + emailForm.getForm().findField('msg').getValue(),
isUpload : true,
success : function(obj) {
message = '<span style="color:green;">Reports generated successfully. '
+ addedNote + '</span>';
Ext.getCmp('details-panel').body.update(message);
visitationStore.reload();
visitationGrid.getView().refresh();
},
failure : function(obj) {
message = '<span style="color:green;">Oops!</span>';
Ext.getCmp('details-panel').body.update(message);
}
});
} else {
Ext.MessageBox.alert('Failed',
'Please select one or more rows to print.');
}

};

var viewOptionsMenu = new Ext.menu.Menu({
items : [{
text : 'All Reports',
checked : true,
group : 'theme',
handler : function() {
var view = 'ALL';
viewOptions(view);
}
}, {
text : 'Open Reports',
checked : false,
group : 'theme',
handler : function() {
var view = 'OPEN';
viewOptions(view);
}
}, {
text : 'Filed Reports',
checked : false,
group : 'theme',
handler : function() {
var view = 'FILED';
viewOptions(view);
}
}]
});

var viewOptionsBtn = {
xtype : 'button',
text : 'List Options',
ref : '../viewBtn',
disabled : false,
menu : viewOptionsMenu
};

function loadViewOptionsBtn() {

if (treePanelExt.getNodeById('admin')) {
// console.log('admin');
// console.dir(viewOptionsButton);

viewOptionsMenu.addMenuItem({
text : 'Reviewed Reports',
checked : false,
group : 'theme',
disabled : false,
handler : function() {
var view = 'REVIEWED';
viewOptions(view);
}
});

} else {
// console.log('not admin');
}
};

var deliveryOptionsMenu = new Ext.menu.Menu({
items : [{
xtype : 'menuitem',
text : 'Print Selected',
iconCls : 'icon-printer',
tooltip : 'Click to print selected documents.',
handler : function() {
var mode = 'PRINT';
submitJob(mode);
}
}, {
xtype : 'menuitem',
text : 'Report Selected',
iconCls : 'icon-report_go',
tooltip : 'Click to report selected documents.',
handler : function() {
var mode = 'REPORT';
submitJob(mode);
}
}]
});

var deliveryOptionsBtn = {
xtype : 'button',
text : 'Delivery Options',
ref : '../deliverBtn',
tooltip : 'Check off reports to deliver.',
disabled : true,
menu : deliveryOptionsMenu
};

function loadDeliveryOptionsBtn() {

if (treePanelExt.getNodeById('admin')) {
// console.log('admin');
deliveryOptionsMenu.addMenuItem({
xtype : 'menuitem',
text : 'Email Selected',
iconCls : 'icon-email_attach',
tooltip : 'Click to email selected documents.',
handler : function() {
// var mode = 'EMAIL';
// submitJob(mode);
emailWindow.show();
}
});

} else {
// console.log('not admin');
}
};

var markAsSeparator = {
xtype : 'tbseparator',
ref : '../markAsSeparator',
hidden : true
};

var markAsOptionsMenu = new Ext.menu.Menu({
items : [{
xtype : 'menuitem',
text : 'Reviewed',
iconCls : 'icon-newspaper',
tooltip : 'Click to mark selected documents as reviewed',
handler : function() {
var mode = 'REVIEWED';
submitJob(mode);
}
}, {
xtype : 'menuitem',
text : 'Not Reviewed',
// iconCls : 'icon-report_go',
tooltip : 'Click to mark selected documents as not reviewed',
handler : function() {
var mode = 'NOT_REVIEWED';
submitJob(mode);
}
}]
});

var markAsOptionsBtn = new Ext.Button({
// xtype : 'button',
text : 'Mark As Options',
ref : '../markAsBtn',
tooltip : 'Mark reports',
hidden : true,
disabled : true,
menu : markAsOptionsMenu
});

function loadMarkAsOptionsBtn() {
if (treePanelExt.getNodeById('admin')) {
// console.log('set visible');
visitationGrid.markAsSeparator.setVisible(true);
visitationGrid.markAsBtn.setVisible(true);
} else {
// console.log('not admin');
}
};

var filtersStore = new Ext.data.JsonStore({
url : '/cgidev2p/jsonStr016.pgm',
root : 'data',
// fields : ['zipString', 'stateString'],
fields : ['zips', 'state'],
autoLoad : false
});

var detailEl;
var message;

var detailsPanel = {
id : 'details-panel',
title : 'Details',
region : 'center',
bodyStyle : 'padding-bottom:15px;background:#eee;',
autoScroll : true,
html : '<p class="details-info">When you select a layout from the tree, additional details will display here.</p>'
};

var startPage = {
id : 'start-page-panel',
layout : 'fit',
bodyStyle : 'padding:25px',
contentEl : 'start-page-div'
};

var comingSoon = {
id : 'coming-panel',
layout : 'fit',
bodyStyle : 'padding:25px',
contentEl : 'coming-div'
};

var treeLoaderExt = new Ext.tree.TreeLoader({
// dataUrl : 'tree-data.json'
dataUrl : '/cgidev2p/jsontree03.pgm',
listeners : {
load : function(loader, node, response) {
// console.log('data is loaded');
loadViewOptionsBtn();
loadDeliveryOptionsBtn();
loadMarkAsOptionsBtn();
// viewport.show();
}
}
});

var treeRoot = new Ext.tree.AsyncTreeNode();

var treePanelExt = new Ext.tree.TreePanel({
id : 'navTree',
autoScroll : true,
rootVisible : false,
loader : treeLoaderExt,
root : treeRoot,
listeners : {
click : function(node, event) {
// console.log(node.id);

if (node.id.substring(0, 10) == 'visitation') {
userid = node.id.substring(11);
userName = node.text.substring(9);
// console.log(userName);
filtersForm.getForm().findField('hiddenUser')
.setValue(userid);
filtersForm.getForm().findField('combo-ssn')
.setValue('');
filtersForm.getForm().findField('zips')
.setValue('');
filtersForm.getForm().findField('state')
.setValue('');
visitationStore.load({
params : {
state : filtersForm.getForm()
.findField('state')
.getValue(),
ssn : filtersForm.getForm()
.findField('combo-ssn')
.getValue(),
zips : filtersForm.getForm()
.findField('zips')
.getValue(),
format : 'JSON',
dummy : 'tree',
userid : userid,
view : filtersForm.getForm()
.findField('hiddenView')
.getValue()
}
});

filtersForm.form.load({
url : '/cgidev2p/jsonStr016.pgm',
params : {
hiddenUser : userid
},
method : 'GET'
// waitMsg : 'Loading data ...'
});
if (userid !== 'all') {
visitationGrid
.setTitle('List of visitations for '
+ userName);
filtersWindow
.setTitle('List filters for '
+ userName);
// filtersForm.getForm().findField('zips').setValue(visitationStore.reader.jsonData.data.hiddenZips);
// filtersForm.getForm().findField('state').setValue(filtersForm.getForm().findField('hiddenStates').getValue());
} else {
visitationGrid.setTitle('List of visitations');
}
} else if (node.id == 'user-maintenance') {
userMaintenanceWindow.show();
// layout.show();
}
// visitationGrid.reviewedBtn.setDisabled(false);
}
}

});

// Assign the changeLayout function to be called on tree node click.
treePanelExt.on('click', function(n) {
var sn = this.selModel.selNode || {};
if (n.leaf && n.id !== sn.id) {
Ext.getCmp('content-panel').layout.setActiveItem(n.id
.substring(0, 10)
+ '-panel');
}
});

var tipRenderer = function(chart, record, index, series) {
var seriesData = record.data;
var total = 0;
Ext.each(series.data, function(obj) {
total += parseInt(obj.total, 10);
});
var slicePct = (seriesData.total / total) * 100;
slicePct = ' (' + slicePct.toFixed(2) + '%)';
var rangeMsg = 'Fund : ' + seriesData.fund;
var empMsg = 'Fund Amount (%) : '
+ Ext.util.Format.number(seriesData.total, '0,0') + slicePct;
return rangeMsg + '\n' + empMsg;
};

var states = new Ext.data.SimpleStore({
fields : ['abbr', 'state', 'nick', 'cls'],
data : Ext.exampledata.states,
sortInfo : {
field : 'state',
direction : 'ASC'
}
});

var emailAddress = new Ext.data.SimpleStore({
fields : ['name', 'email', 'emailName'],
data : Ext.exampledataemail.emailAddress,
sortInfo : {
field : 'name',
direction : 'ASC'
}
});

var memberStore = new Ext.data.JsonStore({
storeId : 'memberStore',
root : 'data',
url : '/cgidev2p/jsonStore2.pgm',
fields : [{
name : 'name'
}, {
name : 'ssn'
}]
});

var filtersForm = new Ext.FormPanel({
id : 'filters-form',
border : false,
frame : true,
padding : 8,
labelWidth : 120,
items : [{
allowBlank : true,
msgTarget : 'title',
resizable : true,
xtype : 'combo',
store : 'memberStore',
name : 'combo-ssn',
id : 'combo-ssn',
displayField : 'name',
valueField : 'ssn',
width : 300,
anchor : '0 0',
fieldLabel : 'Member Name',
navigateItemsWithTab : false,
emptyText : 'Start typing member ssn or name'
}, {
allowBlank : true,
msgTarget : 'title',
id : 'selector4',
xtype : 'superboxselect',
fieldLabel : 'State(s)',
resizable : true,
name : 'state',
anchor : '100%',
store : states,
mode : 'local',
displayField : 'state',
displayFieldTpl : '{state} ({abbr})',
valueField : 'abbr',
navigateItemsWithTab : false,
emptyText : 'Click arrow to select state(s)'
}, {
allowBlank : true,
msgTarget : 'title',
resizable : true,
xtype : 'textfield',
name : 'zips',
id : 'zips',
displayField : 'zips',
valueField : 'zips',
anchor : '100%',
// anchor : '0 0',
fieldLabel : 'Zip Code(s)',
navigateItemsWithTab : false,
emptyText : 'Enter first 3 digits of zip. Separate by blank or comma.'
}, {
xtype : 'textfield',
name : 'hiddenUser',
hidden : true
}, {
xtype : 'textfield',
name : 'hiddenView',
hidden : true
}, {
xtype : 'textfield',
id : 'userType',
name : 'userType',
hidden : true
}],
buttons : [{
text : 'Apply',
disabled : false,
handler : function() {
visitationStore.load({
params : {
state : filtersForm.getForm()
.findField('state').getValue(),
ssn : filtersForm.getForm()
.findField('combo-ssn').getValue(),
zips : filtersForm.getForm().findField('zips')
.getValue(),
userid : filtersForm.getForm()
.findField('hiddenUser').getValue(),
dummy : 'apply_button',
view : filtersForm.getForm()
.findField('hiddenView').getValue(),
format : 'JSON'
}
});
filtersWindow.hide();
}
}, {
xtype : 'button',
text : 'Clear Filters',
id : 'filtersForm-reset',
// iconCls : 'reset',
handler : function() {
filtersForm.form.reset();
message = '<span style="color:green;">Form reset successfully!</span>';
Ext.getCmp('details-panel').body.update(message);
}
}, {
text : 'Cancel',
handler : function() {
filtersWindow.hide();
}
}]
});

var xg = Ext.grid;
var rowCount = 0;

states2 = new Ext.data.SimpleStore({
fields : ['abbr', 'state', 'nick', 'cls'],
data : Ext.exampledata.states,
sortInfo : {
field : 'state',
direction : 'ASC'
}
});

var User = Ext.data.Record.create([{
name : 'gUserid',
type : 'string',
allowBlank : false
}, {
name : 'gName',
type : 'string',
allowBlank : false
}, {
name : 'gEmail',
type : 'string',
allowBlank : false
}, {
name : 'gStates',
type : 'string'
}, {
name : 'gZips',
type : 'string'
}]);

var sm = new xg.CheckboxSelectionModel({
tooltip : 'Click to select',
// locked : false,
listeners : {
selectionchange : function(sm) {
if (sm.getCount()) {
rowCount = sm.getCount();
var selections = userMaintenaceGrid
.getSelectionModel().getSelections();
} else {
rowCount = 0;
}
}
}
});

var userProfileStore = new Ext.data.JsonStore({
url : '/cgidev2p/jsonStr018.pgm',
storeId : 'userProfileStore',
autoLoad : false,
remoteSort : false,
waitMsg : 'Loading ...',
root : 'data',
fields : [{
name : 'wrkusrprf_userid'
}, {
name : 'wrkusrprf_username'
}]
});

var userMaintenanceStore = new Ext.data.JsonStore({
url : '/cgidev2p/jsonStr017.pgm',
storeId : 'userMaintenanceStore',
autoLoad : false,
remoteSort : false,
waitMsg : 'Loading ...',
root : 'data',
fields : [{
name : 'gUserid'
}, {
name : 'gName'
}, {
name : 'gEmail'
}, {
name : 'gStates'
}, {
name : 'gZips'
}],
listeners : {
beforeload : function(store, meta) {
// meta.params.recordID =
// Ext.getCmp('combo-ssn').getValue();
}
}
});

var editor = new Ext.ux.grid.RowEditor({
saveText : "Update",
cancelText : "Cancel",
// clicksToEdit: 1,
errorSummary : true
});

var userMaintenanceGrid = new Ext.grid.GridPanel({
id : 'userMaintenanceGrid',
store : userMaintenanceStore,
plugins : [editor],
deferRowRender : true,
stripeRows : true,
autoExpandColumn : false,
tbar : {
xtype : 'toolbar',
items : [{
xtype : 'button',
text : 'Add User',
iconCls : 'icon-user_add',
ref : '../addBtn',
handler : function() {
var e = new User({
gUserid : 'USERID',
new_user : true
});
editor.stopEditing();
userMaintenanceStore.insert(0, e);
userMaintenanceGrid.getView().refresh();
userMaintenanceGrid.getSelectionModel()
.selectRow(0);
editor.startEditing(0);
editor.values = {};
}
}, {
xtype : 'button',
text : 'Remove User',
iconCls : 'icon-user_delete',
ref : '../removeBtn',
disabled : true,
handler : function() {
Ext.MessageBox.confirm(' ',
'Are you sure you want to do that?',
function(btn) {
if (btn == 'yes') {

editor.stopEditing();
var s = userMaintenanceGrid
.getSelectionModel()
.getSelections();
for (var i = 0, r; r = s[i]; i++) {

Ext.Ajax.request({
url : '/cgidev2p/jsonsbm002.pgm',
method : 'POST',
params : {
dummy : 'remove-record',
pAction : 'remove',
pUserid : r
.get('gUserid'),
pName : r.get('gName'),
pEmail : r
.get('gEmail'),
pStates : r
.get('gStates'),
pZips : r.get('gZips')
},
success : function() {
userMaintenanceStore
.remove(r);
}
});
userMaintenanceStore.remove(r);
};
userMaintenanceStore.reload();
treePanelExt.getLoader()
.load(treeRoot);
}
});

}
}]
},
columns : [{
xtype : 'gridcolumn',
header : 'User ID',
width : 100,
dataIndex : 'gUserid',
sortable : true,
editor : {
xtype : 'combo',
store : 'userProfileStore',
name : 'comboUserID',
mode : 'remote',
id : 'comboUserID',
editable : false,
displayField : 'wrkusrprf_userid',
valueField : 'wrkusrprf_username',
vtype : 'testUserid',
vtypeText : 'Cannot be the default USERID',
emptyText : 'Select a user',
listeners : {
scope : this,
'select' : function(store) {

var m = Ext.getCmp('comboUserID')
.getValue('wrkusrprf_username');

var m1 = m.substring(10, 50);
Ext.getCmp('editorUsername').setValue(m1);

var m2 = m.substring(0, 10);
Ext.getCmp('comboUserID').setValue(m2);

var m3 = m.substring(60, 100);
Ext.getCmp('editorUserEmail').setValue(m3);

},
beforequery : function(qe) {
delete qe.combo.lastQuery;
}
}
}
}, {
xtype : 'gridcolumn',
id : 'username',
name : 'username',
header : 'Name',
width : 150,
dataIndex : 'gName',
sortable : true,
editor : new Ext.form.TextField({
// vtype : 'testValidation',
// vtypeText : 'I am afraid this is not valid',
id : 'editorUsername',
name : 'editorUsername',
allowBlank : false,
readonly : false
})

}, {
xtype : 'gridcolumn',
id : 'userEmail',
name : 'userEmail',
header : 'Email',
width : 150,
dataIndex : 'gEmail',
sortable : false,
// emptyText : 'Enter zips separated by comma or space',
editor : new Ext.form.TextField({
// vtype : 'email',
id : 'editorUserEmail',
name : 'editorUserEmail',
allowBlank : false
})
}, {
xtype : 'gridcolumn',
header : 'States',
width : 200,
dataIndex : 'gStates',
sortable : true,
editor : {
xtype : 'superboxselect',
id : 'grid-superbox',
fieldLabel : 'State(s)',
resizable : true,
name : 'state',
anchor : '100%',
store : states2,
mode : 'local',
displayField : 'state',
displayFieldTpl : '{state} ({abbr})',
valueField : 'abbr',
navigateItemsWithTab : false,
emptyText : 'Click arrow to select state(s)'
}
}, {
xtype : 'gridcolumn',
header : 'Zips',
width : 150,
dataIndex : 'gZips',
sortable : true,
emptyText : 'Enter zips separated by comma or space',
editor : new Ext.form.TextField()
}],
bbar : {
xtype : 'paging',
store : 'userMaintenanceStore',
autoScroll : true,
pageSize : 20,
displayInfo : true,
displayMsg : 'Displaying user(s) {0} - {1} of {2}',
emptyMsg : "No users found",
baseParams : {
// recordID : Ext.getCmp('combo-ssn').getValue(),
start : 0,
limit : 20,
dummy : 'paging-users'
}

}
});

var userMaintenanceWindow = new Ext.Window({
title : 'User Maintenance',
width : 800,
height : 400,
layout : 'fit',
closeAction : 'hide',
modal : true,
items : [userMaintenanceGrid],
listeners : {
scope : this,
single : true,
activate : function(panel) {
this.Ext.StoreMgr.get('userMaintenanceStore').load({
params : {
start : 0,
limit : 30,
dummy : 'dependent-store-load3'
}
});
}
}
});

userMaintenanceGrid.getSelectionModel().on('selectionchange', function(sm) {
userMaintenanceGrid.removeBtn.setDisabled(sm.getCount() < 1);
});

editor.on({
scope : this,
beforeedit : function(roweditor, changes, record, rowIndex) {
// filtersForm.getForm().findField('zips').getValue();
// var a = Ext.getCmp('addBtn').getValue();
// var a = record.get('addBtn');
// console.log(a);
// Ext.getCmp('comboUserID').disable();
},
afteredit : function(roweditor, changes, record, rowIndex) {
// your save logic here - might look something like this:
Ext.Ajax.request({
url : '/cgidev2p/jsonsbm002.pgm',
method : 'POST',
params : {
dummy : 'update-record',
pAction : 'update',
pUserid : record.get('gUserid'),
pName : record.get('gName'),
pEmail : record.get('gEmail'),
pStates : record.get('gStates'),
pZips : record.get('gZips')
},
success : function() {
// post-processing here - this might include
// reloading the grid if there are
// calculated
// fields
// console.log('reload tree 2');
// treeLoaderExt.getLoader().load(root);
}
});
treePanelExt.getLoader().load(treeRoot);
}
});

editor.on('canceledit', function(roweditor, forced) {
editor.stopEditing();
var s = userMaintenanceGrid.getSelectionModel().getSelections();
for (var i = 0; i < s.length; i++) {
r = s[i];
if (r.data.new_user)
userMaintenanceGrid.getStore().remove(r);
}
});

var saveForm = new Ext.FormPanel({
id : 'save-form',
border : false,
frame : true,
padding : 8,
labelWidth : 120,
padding : 5,
html : 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
buttons : [{
text : 'Save',
disabled : false,
handler : function() {
detailsForm.getForm().submit({
method : 'POST',
waitTitle : 'Connecting',
waitMsg : 'Saving data...',
success : function() {
saveWindow.hide();
detailsWindow.hide();
visitationStore.reload();
visitationGrid.getView().refresh();
},
failure : function(form, action) {
// Ext.MessageBox.alert('Failed','for
// some reason.');
saveWindow.hide();
Ext.getCmp('popup-panel')
.setActiveTab(4);
}
});
}

}, {
text : 'Do not save',
handler : function() {
saveWindow.hide();
detailsWindow.hide();
}
}, {
text : 'Cancel',
handler : function() {
saveWindow.hide();
}
}]
});

var detailsForm = new Ext.FormPanel({
url : '/cgidev2p/jsonsbm001.pgm',
method : 'POST',
// id : 'details-form',
//waitMsgTarget : true,
baseParams : {
dummy : 'details-form-dummy'
},
layout : 'fit',
monitorValid : true,
trackResetOnLoad : true,
border : false,
listeners : {
clientvalidation : function(form) {
if (form.getForm().isDirty()) {
Ext.getCmp('saveBtn').enable();
} else {
Ext.getCmp('saveBtn').disable();
}
}
},

items : [{
xtype : 'tabpanel',
id : 'popup-panel',
activeTab : 0,
anchor : '100% 100%',
deferredRender : false,
layoutOnTabChange : true,
waitMsgTarget : true,
defaults : {
layout : 'form',
labelWidth : 80,
defaultType : 'displayfield',
bodyStyle : 'padding:10px',
hideMode : 'offsets'
},
items : [{
title : 'Member Info',
autoScroll : true,
waitMsgTarget : true,
padding : 8,
items : [{
xtype : 'fieldset',
ref : '../../firstSet',
title : 'MEMBER INFORMATION',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{
fieldLabel : 'Name',
name : 'name'
}, {
fieldLabel : 'Date of Birth',
name : 'dob'
}, {
fieldLabel : 'Status',
name : 'status'
}, {
fieldLabel : 'SSN',
name : 'ssn'
}, {
name : 'essn',
hidden : true
}, {
fieldLabel : 'Ordination',
name : 'ordain'
}, {
fieldLabel : 'Retired',
name : 'retired',
ref : '../../../retired'
}, {
fieldLabel : 'Date of Last Visit',
name : 'dov'
}]

}, {
xtype : 'fieldset',
ref : '../../subheading',
title : 'SUBHEADING',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{
fieldLabel : 'Name',
name : 'sub_name',
ref : '../../../sub_name'
}, {
fieldLabel : 'Date of Birth',
name : 'sub_dob',
ref : '../../../sub_dob'
}, {
fieldLabel : 'Retired',
name : 'sub_retired',
ref : '../../../sub_retired'
}, {
fieldLabel : 'Date of Death',
name : 'sub_dod',
ref : '../../../sub_dod'
}, {
name : 'subheading',
hidden : true
}]
}, {
xtype : 'button',
id : 'show-doc-btn',
text : 'Get Word version',
iconCls : 'icon-page_white_word',
width : 30,
align : 'right',
handler : function() {
// console.log(detailsForm.getForm().findField('essn').getValue());
var body = Ext.getBody();
var myForm = body.createChild({
tag : 'form',
cls : 'x-hidden',
id : 'hidden_form',
method : 'post',
target : '_blank'
});

Ext.Ajax.request({
url : '/cgidev2p/jsonStr014.pgm',
form : myForm,
params : {
// recordID : rec.get('ssn'),
batch_ssn : detailsForm
.getForm()
.findField('essn')
.getValue(),
batch_mode : 'PRINT',
batch_format : 'DOC'
},
isUpload : true

});
}
}]

}, {
title : 'Address',
iconCls : 'icon-map',
autoScroll : true,
labelAlign : 'left',
bodyStyle : 'padding: 10px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{
fieldLabel : 'Address',
name : 'addr1',
readonly : true,
id : 'addr1'
}, {
name : 'addr2',
readonly : true,
id : 'addr2'
}, {
name : 'addr3',
readonly : true,
id : 'addr3'
}, {
fieldLabel : 'City, State Zip ',
name : 'city-state-zip',
readonly : true,
id : 'city-state-zip'
}, {
name : 'dummy-address-line',
id : 'dummy-address-line'
}, {
xtype : 'textarea',
fieldLabel : 'Directions',
name : 'directions',
id : 'directions',
height : 250,
width : 400,
autoscroll : true
}, {
xtype : 'textfield',
hidden : true,
name : 'gmap-string',
id : 'gmap-string'
}, {
xtype : 'button',
id : 'show-btn',
text : 'Get Google Map',
iconCls : 'icon-map',
width : 30,
align : 'right',
handler : function() {
mapwin = new Ext.Window({
layout : 'fit',
title : 'GMap Window',
closeAction : 'hide',
width : 400,
height : 400,
x : 40,
y : 60,
items : {
xtype : 'gmappanel',
zoomLevel : 14,
gmapType : 'map',
mapConfOpts : ['enableScrollWheelZoom',
'enableDoubleClickZoom',
'enableDragging'],
mapControls : ['GSmallMapControl',
'GMapTypeControl',
'NonExistantControl'],
setCenter : {
geoCodeAddr : Ext
.getCmp('gmap-string')
.getValue(),
marker : {
title : Ext.getCmp('addr1')
.getValue()
+ ','
+ Ext
.getCmp('city-state-zip')
.getValue()
+ ',USA'
}
}
}
});
mapwin.show();
}
}]
}, {
title : 'Contact',
iconCls : 'icon-telephone',
autoScroll : true,
padding : 8,
items : [{
xtype : 'fieldset',
// id : 'firstSet',
title : 'EMAIL ADDRESS',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{
fieldLabel : 'Personal Email',
name : 'pEmail',
id : 'pEmail'
}, {
fieldLabel : 'Work Email',
name : 'wEmail'
}, {
fieldLabel : 'Church Email',
name : 'cEmail'
}]

}, {
xtype : 'fieldset',
// id : 'secondSet',
title : 'PHONE NUMBERS',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{
fieldLabel : 'Home',
name : 'home'
}, {
fieldLabel : 'Business',
name : 'business'
}, {
fieldLabel : 'Mobile',
name : 'mobile'
}]
}]

}, {
xtype : 'textarea',
title : 'Comments',
hideLabel : true,
name : 'comments',
id : 'comments',
iconCls : 'icon-comment',
flex : 1,
defaults : {
padding : 5
}
}, {
title : 'File Report / Review',
labelAlign : 'left',
padding : 5,
autoScroll : true,
items : [{
xtype : 'fieldset',
ref : '../../fileReport',
title : 'FILE REPORT',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 120,
defaults : {
xtype : 'displayfield',
width : 350
},
items : [{

xtype : 'radiogroup',
fieldLabel : 'Type of visit',
name : 'visit-type',
id : 'visit-type',
columns : [100, 100],
vtype : 'testVisit',
vtypeText : 'Visit type and date must be completed.',
items : [{
boxLabel : 'Home Visit',
name : 'visit-type',
inputValue : 'V'
}, {
boxLabel : 'Phone',
name : 'visit-type',
inputValue : 'P'
}]
}, {
xtype : 'datefield',
fieldLabel : 'Date of visit',
id : 'date-of-visit',
name : 'date-of-visit',
editable : false,
maxValue : today,
width : 150
}]
}, {
xtype : 'fieldset',
ref : '../../reviewReport',
hidden : true,
title : 'REVIEW REPORT',
autoHeight : true,
labelAlign : 'left',
bodyStyle : 'padding: 5px',
labelWidth : 150,
items : [{
xtype : 'checkbox',
name : 'reviewed',
id : 'reviewed',
fieldLabel : 'Mark report as reviewed',
inputValue : 'X'
}]
}]
}]
}],
buttons : [{
// xtype : 'button',
id : 'saveBtn',
text : ' Save',
formBind : true,
disabled : true,
iconCls : 'icon-disk',
width : 50,
align : 'right',
handler : function() {
detailsForm.getForm().submit({
method : 'POST',
waitTitle : 'Connecting',
waitMsg : 'Sending data...',
success : function() {
saveWindow.hide();
detailsWindow.hide();
detailsForm.form.reset();
visitationStore.reload();
visitationGrid.getView().refresh();
},
failure : function(form, action) {
Ext.getCmp('popup-panel')
.setActiveTab(4);
}
});
}
}, {
text : 'Close',
handler : function() {
if (detailsForm.getForm().isDirty()) {
saveWindow.show();
} else {
detailsWindow.hide();
}
detailsForm.form.reset();
// detailsForm.values = {};
}
}]
});

var emailForm = new Ext.form.FormPanel({
baseCls : 'x-plain',
labelWidth : 55,
// url : 'dummy.pgm',
defaultType : 'textfield',
monitorValid : true,
items : [{
allowBlank : false,
editable : true,
msgTarget : 'title',
id : 'selector5',
xtype : 'superboxselect',
fieldLabel : 'Email to',
resizable : false,
name : 'emailTo',
anchor : '100%',
store : emailAddress,
mode : 'local',
displayField : 'name',
displayFieldTpl : '{name} ({email})',
valueField : 'emailName',
navigateItemsWithTab : false,
emptyText : 'Click arrow to select email(s)'
}, {
fieldLabel : 'Subject',
allowBlank : false,
name : 'subject',
anchor : '100%', // anchor width by percentage
value : 'Visitation Reports'
}, {
xtype : 'textarea',
hideLabel : true,
// hidden : true,
name : 'msg',
anchor : '100% -53' // anchor width by percentage
// and height by raw adjustment
}],
buttons : [{
text : 'Send',
formBind : true,
disabled : false,
handler : function() {
var mode = 'EMAIL';
submitJob(mode);
emailWindow.hide();
emailForm.form.reset();
}
}, {
text : 'Cancel',
handler : function() {
emailWindow.hide();
emailForm.form.reset();
}
}]
});

var emailWindow = new Ext.Window({
title : 'Email Visitation Reports',
modal : true,
width : 500,
height : 300,
minWidth : 300,
minHeight : 200,
layout : 'fit',
// closeAction : 'hide',
closable : false,
plain : true,
bodyStyle : 'padding:5px;',
buttonAlign : 'center',
items : emailForm
});

var filtersWindow = new Ext.Window({
layout : 'fit',
// monitorValid : true,
border : false,
modal : true,
title : 'Visitation Grid Filters',
iconCls : 'icon-page_find',
closable : true,
closeAction : 'hide',
autoScroll : true,
width : 500,
height : 250,
defaultType : 'textfield',
labelAlign : 'right',
items : [filtersForm]
});

var saveWindow = new Ext.Window({
layout : 'fit',
border : false,
modal : true,
title : 'Save changes?',
iconCls : 'icon-disk',
closable : true,
closeAction : 'hide',
autoScroll : true,
width : 300,
height : 150,
defaultType : 'textfield',
labelAlign : 'right',
items : [saveForm]
});

DataWindow = Ext.extend(Ext.Window, {
initComponent : function() {
Ext.apply(this, {
modal : true,
waitMsgTarget : true,
width : 600,
height : 600,
layout : 'fit',
border : false,
title : 'Visitation Report Details',
iconCls : 'icon-user_brown',
closable : false,
closeAction : 'hide',
autoScroll : true,
defaultType : 'textfield',
labelAlign : 'right',
items : [detailsForm]
});
DataWindow.superclass.initComponent.apply(this, arguments);
},

showWithData : function(data) {

Ext.apply(detailsForm.form.baseParams, {
recordID : data
});
detailsForm.form.load({
url : '/cgidev2p/jsonStr013.pgm',
waitMsgTarget : true,
waitMsg : 'Loading...',
success : function(form, action) {

detailsForm.subheading.setTitle(detailsForm.getForm()
.findField('subheading').getValue());

if (detailsForm.getForm().findField('sub_name').getValue() != '') {
detailsForm.sub_name.label.update('Name:');
} else {
detailsForm.sub_name.label.update('');
detailsForm.sub_retired.label.update('');
// detailsForm.getForm().findField('sub_retired').setValue('');
}

if (detailsForm.getForm().findField('sub_dob').getValue() != '') {
detailsForm.sub_dob.label.update('Date of Birth:');
} else {
detailsForm.sub_dob.label.update('');
}

if (detailsForm.getForm().findField('sub_dod').getValue() != '') {
detailsForm.sub_dod.label.update('Date of Death:');
} else {
detailsForm.sub_dod.label.update('');
}

if (detailsForm.getForm().findField('sub_retired')
.getValue() != '') {
detailsForm.sub_retired.label.update('Retired:');
detailsForm.retired.label.update('');
} else {
detailsForm.sub_retired.label.update('');
detailsForm.retired.label.update('Retired:');
}
}
});

this.show();
}
});

// ...

var detailsWindow = new DataWindow();

var visitationStore = new Ext.data.JsonStore({
url : '/cgidev2p/jsonStr012.pgm',
storeId : 'visitationStore',
totalProperty : 'results',
autoLoad : false,
waitMsg : 'Loading ...',
root : 'data',
fields : [{
name : 'ssn'
}, {
name : 'name'
}, {
name : 'addr1'
}, {
name : 'addr2'
}, {
name : 'addr3'
}, {
name : 'city'
}, {
name : 'st'
}, {
name : 'zip'
}, {
name : 'phone'
}, {
name : 'status'
}, {
name : 'ordain'
}, {
name : 'birth-date',
type : 'date',
dateFormat : 'c'
}, {
name : 'visit-date',
type : 'date',
dateFormat : 'c'
}, {
name : 'reportSent'
}, {
name : 'reviewed'
}, {
name : 'visit-type'
}],
listeners : {
beforeload : function(store, meta) {
meta.params.state = filtersForm.getForm().findField('state')
.getValue();
meta.params.ssn = filtersForm.getForm().findField('combo-ssn')
.getValue();
meta.params.zips = filtersForm.getForm().findField('zips')
.getValue();
meta.params.hiddenUser = filtersForm.getForm()
.findField('hiddenUser').getValue();
dummy : 'store';
format : 'JSON';
//meta.params.view = filtersForm.getForm().findField('hiddenView').getValue();
}
}
});

var sm = new xg.CheckboxSelectionModel({
tooltip : 'Click to select',
listeners : {
selectionchange : function(sm) {
if (sm.getCount()) {
rowCount = sm.getCount();
var selections = visitationGrid.getSelectionModel()
.getSelections();
visitationGrid.deliverBtn.setDisabled(false);
visitationGrid.markAsBtn.setDisabled(false);
} else {
rowCount = 0;
visitationGrid.deliverBtn.setDisabled(true);
visitationGrid.markAsBtn.setDisabled(true);
}
}
}
});

var visitationGrid = new xg.GridPanel({
title : 'Visitation Report',
id : 'visitation-panel',
store : visitationStore,
deferRender : true,
stripeRows : true,
loadMask : true,
sm : sm,
viewConfig : {

getRowClass : function(record, index, rowParams, store) {

var myDate = new Date(record.get('visit-date'));
var myDateYear = myDate.getFullYear();
var currentDate = new Date();
var currentYear = currentDate.getFullYear();

if (myDateYear == currentYear) {
return 'visitedCss';
} else {
return '';
}

}
},
tbar : {
xtype : 'toolbar',
items : [
{
xtype : 'button',
text : 'Change Filters',
tooltip : 'Click to set data filters.',
iconCls : 'icon-page_find',
handler : function() {
filtersWindow.show();
Ext.getCmp('filters-reset').enable();
}
},
'-',
{
xtype : 'button',
text : 'Clear Filters',
tooltip : 'Click to clear current data filters.',
id : 'filters-reset',
iconCls : 'reset',
disabled : true,
handler : function() {
filtersForm.form.reset();
message = '<span style="color:green;">Form reset successfully!</span>';
Ext.getCmp('details-panel').body.update(message);
visitationStore.load({
params : {
state : filtersForm.getForm()
.findField('state').getValue(),
ssn : filtersForm.getForm()
.findField('combo-ssn').getValue(),
zips : filtersForm.getForm()
.findField('zips').getValue(),
userid : filtersForm.getForm()
.findField('hiddenUser').getValue(),
view : filtersForm.getForm()
.findField('hiddenView').getValue(),
dummy : 'reset_button'
}
});
}
},
{
xtype : 'tbfill'
},
{
xtype : 'button',
text : 'Export Options',
// ref : '../printButton',
disabled : false,
iconCls : 'icon-table_go',
menu : {
xtype : 'menu',
items : [{
xtype : 'menuitem',
text : ' Export to .XLS',
tooltip : 'Click to download current view to Excel.',
iconCls : 'icon-page_excel',
handler : function() {

var body = Ext.getBody();

var myForm = body.createChild({
tag : 'form',
cls : 'x-hidden',
id : 'hidden_form',
method : 'post',
target : '_blank'
});

Ext.Ajax.request({
url : '/cgidev2p/jsonStr012.pgm',
form : myForm,
params : {
state : filtersForm
.getForm()
.findField('state')
.getValue(),
zips : filtersForm
.getForm()
.findField('zips')
.getValue(),
ssn : filtersForm
.getForm()
.findField('combo-ssn')
.getValue(),
hiddenUser : filtersForm
.getForm()
.findField('hiddenUser')
.getValue(),
format : 'XLS'
},
isUpload : true

});
}
}, {
xtype : 'menuitem',
text : 'Export to .CSV',
tooltip : 'Click to download current view to CSV.',
iconCls : 'icon-csv_download',
handler : function() {

var body = Ext.getBody();

var myForm = body.createChild({
tag : 'form',
cls : 'x-hidden',
id : 'hidden_form',
method : 'post',
target : '_blank'
});

Ext.Ajax.request({
url : '/cgidev2p/jsonStr012.pgm',
form : myForm,
params : {
state : filtersForm
.getForm()
.findField('state')
.getValue(),
zips : filtersForm
.getForm()
.findField('zips')
.getValue(),
ssn : filtersForm
.getForm()
.findField('combo-ssn')
.getValue(),
hiddenUser : filtersForm
.getForm()
.findField('hiddenUser')
.getValue(),
format : 'CSV'
},
isUpload : true

});
}
}]
}
}, markAsSeparator, markAsOptionsBtn, '-',
deliveryOptionsBtn, '-', viewOptionsBtn, {
xtype : 'spacer',
width : 10
}]
},
columns : [sm, {
xtype : 'actioncolumn',
width : 80,
items : [{
iconCls : 'icon-vcard',
tooltip : 'Click to view member details',
handler : function(grid, rowIndex, colIndex) {
var rec = visitationStore.getAt(rowIndex);

var myDate = new Date(rec.get('visit-date'));
var myDateYear = myDate.getFullYear();
var currentDate = new Date();
var currentYear = currentDate.getFullYear();

Ext.getCmp('popup-panel').setActiveTab(0);
detailsWindow.showWithData(rec.get('ssn'));
//console.log('visit-type=' + rec.get('visit-type'));
if (treePanelExt.getNodeById('admin')
&& rec.get('visit-type') != ' '
&& myDateYear == currentYear) {
detailsForm.reviewReport.setVisible(true);
} else {
detailsForm.reviewReport.setVisible(false);
}
}
},
// {
// icon : '../icons/page_white_word.png',
// tooltip : 'View Word document',
// handler : function(grid, rowIndex, colIndex) {
// var rec = visitationStore.getAt(rowIndex);
// var body = Ext.getBody();
// var myForm = body.createChild({
// tag : 'form',
// cls : 'x-hidden',
// id : 'hidden_form',
// method : 'post',
// target : '_blank'
// });

// Ext.Ajax.request({
// url : '/cgidev2p/jsonStr014.pgm',
// form : myForm,
// params : {
// recordID : rec.get('ssn'),
// batch_ssn : rec.get('ssn'),
// batch_mode : 'PRINT',
// format : 'DOC'
// },
// isUpload : true

// });
// }
// },
{
// tooltip : 'Report available or sent',
getClass : function(v, meta, rec) {

var myDate = new Date(rec.get('visit-date'));
var myDateYear = myDate.getFullYear();
var currentDate = new Date();
var currentYear = currentDate.getFullYear();

if (rec.get('visit-type') == 'V'
&& myDateYear == currentYear) {
// this.items[1].tooltip = 'Report has been
// sent';
this.items[1].tooltip = 'Visited at home';
// return 'reportSentCss';
return 'homeVisitCss';
} else if (rec.get('visit-type') == 'P'
&& myDateYear == currentYear) {
// } else if (myDateYear == currentYear) {
// this.items[1].tooltip = 'Report is
// available';
this.items[1].tooltip = 'Visited by phone';
// return 'reportAvailableCss';
return 'phoneVisitCss';
} else {
this.items[1].tooltip = '';
return 'emptyCss';
}
}
}, {
getClass : function(v, meta, rec) {

if (rec.get('reviewed') == 'Y') {
this.items[2].tooltip = 'Report has been reviewed';
return 'reviewedCss';
} else {
this.items[2].tooltip = '';
return 'emptyCss';
}
}
}]
}, {
header : 'Name',
dataIndex : 'name',
width : 200,
sortable : true
}, {
name : 'ssn',
dataIndex : 'ssn',
hidden : true
}, {
header : 'Address',
name : 'addr1',
dataIndex : 'addr1',
width : 150,
sortable : false
}, {
header : 'Address',
name : 'addr2',
dataIndex : 'addr2',
width : 150,
sortable : false
}, {
header : 'Address',
name : 'addr3',
dataIndex : 'addr3',
width : 150,
sortable : false
}, {
header : 'City',
dataIndex : 'city',
width : 150,
sortable : true
}, {
header : 'State',
dataIndex : 'st',
width : 50,
sortable : true
}, {
header : 'Zip',
dataIndex : 'zip',
width : 100,
sortable : true
}, {
header : 'Phone',
name : 'phone',
dataIndex : 'phone',
width : 100,
sortable : false
}, {
header : 'Ordain',
name : 'ordain',
dataIndex : 'ordain',
width : 80,
sortable : false
}, {
header : 'Status',
name : 'status',
dataIndex : 'status',
width : 80,
sortable : false
}, {
header : 'DOB',
xtype : 'datecolumn',
// format : 'm/d/Y',
// format : 'Y-m-d',
name : 'birth-date',
dataIndex : 'birth-date',
width : 80,
sortable : false
}, {
header : 'Last Visit',
xtype : 'datecolumn',
// format : 'm/d/Y',
// format : 'Y-m-d',
name : 'visit-date',
dataIndex : 'visit-date',
width : 80,
sortable : true
}],
bbar : {
xtype : 'paging',
store : visitationStore,
autoScroll : true,
pageSize : 50,
displayInfo : true,
displayMsg : 'Displaying eligible visitation(s) {0} - {1} of {2}',
emptyMsg : "No eligible visitations found",
baseParams : {
start : 0,
limit : 50,
// state : filtersForm.getForm().findField('state').getValue(),
userid : filtersForm.getForm().findField('hiddenUser')
.getValue(),
view : filtersForm.getForm().findField('hiddenView').getValue(),
dummy : 'paging_bar'
},
handler : function() {
visitationGrid.getSelectionModel().clearSelections();
}
}
});

var contentPanel = {
id : 'content-panel',
xtype : 'panel',
region : 'center',
layout : 'card',
layoutConfig : {
align : 'stretch'
},
activeItem : 0,
items : [startPage, comingSoon, visitationGrid]
};

var viewport = new Ext.Viewport({
layout : 'border',
frame : true,
renderTo : Ext.getBody(),
items : [contentPanel, {
xtype : 'panel',
region : 'north',
margins : '0 0 2 0',
// width: 100,
tbar : {
xtype : 'toolbar',
items : [{
xtype : 'label',
html : '<b>MMBB Visitation Application</b>',
style : 'font-size: 16px;color:#054988'
}, {
xtype : 'tbfill'
}, {
xtype : 'button',
text : 'Help',
iconCls : 'icon-help',
menu : {
xtype : 'menu',
items : [{
xtype : 'menuitem',
text : 'Help',
iconCls : 'error',
disabled : false,
handler : function() {
// tabs for the center
var tabs = new Ext.TabPanel({
region : 'center',
margins : '3 3 3 0',
activeTab : 0,
defaults : {
autoScroll : true
},

items : [{
title : 'Another Tab',
padding : 10,
autoLoad : {
url : 'visitation_help_2.htm'
}
}]
});

var win = new Ext.Window({
// title : 'Help',
closable : true,
width : 700,
height : 500,
// border:false,
plain : true,
layout : 'border',
// items : [nav, tabs]
items : [tabs]
});
win.show(this);
}
}, {
xtype : 'menuitem',
text : 'Get the Viewers',
iconCls : 'icon-disk_download',
handler : function() {
var w2 = new Ext.Window({
height : 300,
width : 400,
title : 'Get Word and Excel Viewers',
padding : 10,
html : '<p><span style="font-size:12px;"><span style="font-family:arial,helvetica,sans-serif;">In order to view the Word or Excel documents produced by this application, you will need Microsoft Word or Excel installed on your computer. &nbsp;If you do not have this software you may download free viewers so that you may view these documents. &nbsp;Please click on the links below and follow the instructions on each page to download and install these viewers.</span></span></p><p><span style="font-size:12px;"><span style="font-family:arial,helvetica,sans-serif;"><a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=10" target="_blank">Excel Viewer</a></span></span><br />&nbsp;</p><p><span style="font-size:12px;"><span style="font-family:arial,helvetica,sans-serif;"><a href="http://www.microsoft.com/download/en/details.aspx?DisplayLang=en&amp;id=4" target="_blank">Word Viewer</a></span></span><br />&nbsp;</p>'
});
w2.show();
}
}, {
xtype : 'menuitem',
text : 'About',
iconCls : 'about',
handler : function() {
var w = new Ext.Window({
height : 200,
width : 400,
title : 'About',
padding : 10,
html : '<p align="center" /><div style="text-align: -webkit-auto; "><font class="Apple-style-span" size="2" face="arial, helvetica, sans-serif"><p><b>Visitation Module</b> &nbsp;<br />Version: 1.0&nbsp;<br />(c) Copyright MMBB 2011. &nbsp;All rights reserved.</p><p>Visit <a href="http://www.mmbb.org/" target="_blank">http://www.mmbb.org/</a>&nbsp;</p></font></div></p>'
});
w.show();
}
}]
}
}, {
xtype : 'spacer',
width : 10
}]
}
}, {
xtype : 'panel',
title : 'Navigation',
region : 'west',
margins : '0 0 0 0',
width : 200,
layout : 'accordion',
autoScroll : true,
useArrows : true,
singleExpand : true,
split : true,
collapseMode : 'standard',
collapsible : true,
layoutConfig : {
animate : true
},
items : [{
xtype : 'panel',
title : 'Visitation Reporting',
iconCls : 'applications',
layout : 'fit',
items : [treePanelExt]
}]
}, {
region : 'south',
xtype : 'form',
id : 'details-panel',
title : 'Info Center',
collapsible : true,
height : 75,
layout : 'fit',
collapsed : false,
floatable : false,
autoScroll : true,
bodyStyle : {
fontSize : '12px',
fontFace : 'Verdana',
padding : '5px;'
},
margins : '2 0 0 0',
html : 'Informational messages to appear here.'
}]
});

Ext.getCmp('selector4').setValue(new Ext.data.JsonStore({
storeId : 'statesList',
root : 'data',
url : 'state.json',
autoLoad : false,
fields : [{
name : 'states'
}]
}));

viewport.show();

});

mitchellsimoens
20 Nov 2011, 12:13 PM
Where does it complain? I started going through it looking for any errors but then saw that this is a lot of code and gave up.

mjhaston
20 Nov 2011, 1:24 PM
javascriptlint complains here:



136 function viewOptions(view) {
137
138 visitationStore.load({
139 params : {
140 state : filtersForm.getForm().findField('state').getValue(),
141 ssn : filtersForm.getForm().findField('combo-ssn').getValue(),
142 zips : filtersForm.getForm().findField('zips').getValue(),
143 format : 'JSON',
144 dummy : 'function_viewOptions',
145 view : view,
146 userid : userid
147 }
148 });
149 filtersForm.getForm().findField('hiddenView').setValue(view);
150
151 };
==^
lint warning: empty statement or extra semicolon

mjhaston
20 Nov 2011, 1:46 PM
When I go into the IE9 tools and "change user agent string" to any browser other than IE9, IE8, IE7 or IE6 .... my application works!

mjhaston
20 Nov 2011, 4:07 PM
My IE9 issue appears to be corrected with me upgrading to ExtJS 3.4.0

daddie888
21 Nov 2011, 1:19 AM
Hi, i don't know which JS Lint implementation you'r using but mine finds several errors
The second error seems severe enough to break your code, IMO you have an endless loop here


for (i = 0; e = Ext.get(els[i]); i++) {
result = Math.max(result, e.getTextWidth.apply(e, arguments));
}

Here are all the errros my JSLint gave


Lint at line 13 character 44: Use '===' to compare with 'undefined'.
if (this.originalValue == undefined) {
Lint at line 49 character 35: Expected a conditional expression and instead saw an assignment.
for (i = 0; e = Ext.get(els[i]); i++) {
Lint at line 128 character 23: Use '===' to compare with ''.
if (visit == '' && visitDate != '' || visit != '' & visitDate == '') {
Lint at line 128 character 42: Use '!==' to compare with ''.
if (visit == '' && visitDate != '' || visit != '' & visitDate == '') {
Lint at line 128 character 57: Use '!==' to compare with ''.
if (visit == '' && visitDate != '' || visit != '' & visitDate == '') {
Lint at line 128 character 75: Use '===' to compare with ''.
if (visit == '' && visitDate != '' || visit != '' & visitDate == '') {
Lint at line 151 character 6: Unnecessary semicolon.
};
Lint at line 195 character 25: Bad line breaking before '+'.
+ emailForm.getForm().findField('emailTo').getValue()
Lint at line 196 character 25: Bad line breaking before '+'.
+ '&subject=' + emailForm.getForm().findField('subject').getValue()
Lint at line 197 character 25: Bad line breaking before '+'.
+ '&msg=' + emailForm.getForm().findField('msg').getValue(),
Lint at line 201 character 29: Bad line breaking before '+'.
+ addedNote + '</span>';
Lint at line 216 character 6: Unnecessary semicolon.
};
Lint at line 274 character 6: Unnecessary semicolon.
};
Lint at line 326 character 6: Unnecessary semicolon.
};
Lint at line 374 character 6: Unnecessary semicolon.
};
Lint at line 479 character 49: Bad line breaking before '+'.
+ userName);
Lint at line 482 character 49: Bad line breaking before '+'.
+ userName);
Lint at line 504 character 29: Bad line breaking before '+'.
+ '-panel');
Lint at line 518 character 17: Bad line breaking before '+'.
+ Ext.util.Format.number(seriesData.total, '0,0') + slicePct;
Lint at line 794 character 66: Expected a conditional expression and instead saw an assignment.
for (var i = 0, r; r = s[i]; i++) {
Lint at line 815 character 49: Be careful when making functions within a loop. Consider putting the function in a closure.
});
Lint at line 817 character 46: Unnecessary semicolon.
};
Lint at line 1016 character 25: Expected '{' and instead saw 'userMaintenanceGrid'.
userMaintenanceGrid.getStore().remove(r);
Lint at line 1026 character 17: Duplicate member 'padding'.
padding : 5,
Lint at line 1293 character 57: Bad line breaking before '+'.
+ ','
Lint at line 1294 character 57: Bad line breaking before '+'.
+ Ext
Lint at line 1297 character 57: Bad line breaking before '+'.
+ ',USA'
Lint at line 1613 character 80: Use '!==' to compare with ''.
if (detailsForm.getForm().findField('sub_name').getValue() != '') {
Lint at line 1621 character 79: Use '!==' to compare with ''.
if (detailsForm.getForm().findField('sub_dob').getValue() != '') {
Lint at line 1627 character 79: Use '!==' to compare with ''.
if (detailsForm.getForm().findField('sub_dod').getValue() != '') {
Lint at line 1634 character 41: Use '!==' to compare with ''.
.getValue() != '') {
Lint at line 1706 character 25: Label 'dummy' on store statement.
dummy : 'store';
Lint at line 1706 character 25: Expected an assignment or function call and instead saw an expression.
dummy : 'store';
Lint at line 1707 character 26: Label 'format' on JSON statement.
format : 'JSON';
Lint at line 1707 character 26: Expected an assignment or function call and instead saw an expression.
format : 'JSON';
Lint at line 1713 character 12: 'sm' is already defined.
var sm = new xg.CheckboxSelectionModel({
Lint at line 1922 character 29: Bad line breaking before '&&'.
&& rec.get('visit-type') != ' '
Lint at line 1923 character 29: Bad line breaking before '&&'.
&& myDateYear == currentYear) {
Lint at line 1968 character 37: Bad line breaking before '&&'.
&& myDateYear == currentYear) {
Lint at line 1975 character 37: Bad line breaking before '&&'.
&& myDateYear == currentYear) {