|
From: <ken...@us...> - 2008-12-30 20:47:47
|
Revision: 1037
http://andro.svn.sourceforge.net/andro/?rev=1037&view=rev
Author: kendowns
Date: 2008-12-30 20:47:43 +0000 (Tue, 30 Dec 2008)
Log Message:
-----------
1) Converted all object iteration to for(var x = 0; x=object.length;x++) ....
2) Corrected some keyboard handling that got messed up with ie compatibility
3) Moved "keyLabel" function into x6 out of androLib.js, to reduce need for androLib.js.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2008-12-30 17:31:15 UTC (rev 1036)
+++ trunk/andro/clib/x6.js 2008-12-30 20:47:43 UTC (rev 1037)
@@ -75,8 +75,14 @@
$(document).keypress(function(e) {
//e = e ? e : window.event;
x6.console.group("Document Keypress");
- x6.console.log("Here is keypress event: ",e);
- var retval= x6.keyDispatcher(e);
+ if(u.bb.vgfGet('noKeyPress',false)==true) {
+ x6.console.log("noKeyPress was set, ignoring");
+ u.bb.vgfSet('noKeyPress',false);
+ }
+ else {
+ // no log entry, key dispatcher does that
+ var retval= x6.keyDispatcher(e);
+ }
x6.console.groupEnd();
return retval;
});
@@ -106,8 +112,8 @@
// Keyboard handler
keyDispatcher: function(e) {
- var retval = u.keyLabel(e);
- x6.console.log(retval);
+ x6.console.group("Document Level Key Dispatching");
+ var retval = x6.keyLabel(e);
// Possible trapping because of modal dialogs
if(typeof(x6.dialogsAllow)=='object') {
@@ -137,11 +143,9 @@
}
// Now we have a complete key label, fire the event
- x6.console.log("In x6.keyDispatch, code and event follow");
- x6.console.log(retval);
- x6.console.log(e);
if(stopThem.indexOf(retval)>0) {
x6.console.log("x6.keyDispatch: key is in force stop list, stopping propagation.");
+ x6.console.groupEnd();
e.stopPropagation();
return false;
}
@@ -172,14 +176,21 @@
// All othere keys in the no-propagate list are
// stopped here.
if(noPropagate.indexOf(retval)>=0) {
+ x6.console.log("In no propagate list, stopping");
+ x6.console.groupEnd();
e.stopPropagation();
return false;
}
else {
+ x6.console.log("Key dispatch returning true");
+ x6.console.groupEnd();
return true;
}
}
}
+ x6.console.log("key dispatch finished, returning true");
+ x6.console.groupEnd();
+ return true;
},
/*
@@ -244,7 +255,189 @@
else
console[fnname](x1,x2,x3,x4,x5,x6,x7);
}
- }
+ },
+
+ /* KFD 11/26/08
+ EXPERIMENTAL
+ Put here because there is already one in ua, where it
+ really does not belong.
+ Originally used by x6inputs.keydown to figure things out
+ */
+ metaKeys: {
+ 8: 'BackSpace',
+ 9: 'Tab',
+ 13: 'Enter',
+ 16: 'Shift',
+ 17: 'Ctrl',
+ 18: 'Alt',
+ 20: 'CapsLock',
+ 27: 'Esc',
+ 33: 'PageUp',
+ 34: 'PageDown',
+ 35: 'End',
+ 36: 'Home',
+ 37: 'LeftArrow',
+ 38: 'UpArrow',
+ 39: 'RightArrow',
+ 40: 'DownArrow',
+ 45: 'Insert',
+ 46: 'Delete',
+ 112: 'F1' ,
+ 113: 'F2' ,
+ 114: 'F3' ,
+ 115: 'F4' ,
+ 116: 'F5' ,
+ 117: 'F6' ,
+ 118: 'F7' ,
+ 119: 'F8' ,
+ 120: 'F9' ,
+ 121: 'F10',
+ 122: 'F11',
+ 123: 'F12'
+ },
+ keyLabel: function(e) {
+ x6.console.group("Key Label processing, event follows");
+ x6.console.log(e);
+ // if e.originalEvent is defined, this is a jQuery event.
+ // jQuery events have charCode for non-meta keys, and they
+ // shift the alphabet up by 32 characters for no good reason
+ // at all.
+ if(e.originalEvent) {
+ x6.console.log("e.originalEvent exists, this is jQuery");
+ if(e.charCode >= 97 && e.charCode <= 122) {
+ var x = e.charCode - 32;
+ x6.console.log(
+ "Taking charCode and subtracting 32:",e.charCode,x
+ );
+ }
+ else if(e.charCode != 0) {
+ x6.console.log("Taking charCode ",e.charCode);
+ var x = e.charCode
+ }
+ else {
+ x6.console.log("Taking keyCode ",e.keyCode);
+ var x = e.keyCode;
+ }
+ }
+ else {
+ x6.console.log("Taking keyCode ",e.keyCode);
+ var x = e.keyCode;
+ }
+ x6.console.log("Proceeding with this code: ",x);
+
+ x4Keys = this.metaKeys;
+
+ // If they hit one of the control keys, check for
+ // Shift, Ctrl, or Alt
+ var retval = '';
+ if(typeof(x4Keys[x])!='undefined') {
+ retval = x4Keys[x];
+ if(e.ctrlKey) retval = 'Ctrl' + retval;
+ if(e.altKey) retval = 'Alt' + retval;
+ if(e.shiftKey) retval = 'Shift' + retval;
+ x6.console.log("Found meta-key, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
+ }
+
+ // If letters we look at shift key and return
+ // upper or lower case
+ if(x >= 65 && x <= 90) {
+ if(e.shiftKey || e.ctrlKey || e.altKey) {
+ var letters =
+ [ 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+ 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
+ 'V', 'W', 'X', 'Y', 'Z' ];
+ }
+ else {
+ var letters =
+ [ 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u',
+ 'v', 'w', 'x', 'y', 'z' ];
+ }
+ var retval = letters[x - 65];
+ if(e.ctrlKey) retval = 'Ctrl' + retval;
+ if(e.altKey) retval = 'Alt' + retval;
+ x6.console.log("Found letter, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
+ }
+
+ // Numbers or the corresponding codes go here
+ if(x >= 48 && x <= 57) {
+ if(e.shiftKey) {
+ var numbers = [ ')','!','@','#','$','%','^','&','*','(' ];
+ }
+ else {
+ var numbers = [ '0','1','2','3','4','5','6','7','8','9' ];
+ }
+ var retval = numbers[x - 48];
+ if(e.ctrlKey) retval = 'Ctrl' + retval;
+ if(e.altKey) retval = 'Alt' + retval;
+ if(e.shiftKey) retval = 'Shift' + retval;
+ x6.console.log("Found number, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
+ }
+ if(retval!='') {
+ if(e.ctrlKey) retval = 'Ctrl' + retval;
+ if(e.altKey) retval = 'Alt' + retval;
+ if(e.shiftKey) retval = 'Shift' + retval;
+ x6.console.log("Found letter or number, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
+ }
+
+ var lastChance = {
+ 192: '`',
+ 109: '-',
+ 61: '=',
+ 219: '[',
+ 221: ']',
+ 220: '\\',
+ 188: ',',
+ 190: '.',
+ 191: '/',
+ 59: ';',
+ 222: "'"
+ }
+ if(typeof(lastChance[x])!='undefined') {
+ if(e.shiftKey) {
+ var lastChance = {
+ 192: '~',
+ 109: '_',
+ 61: '+',
+ 219: '{',
+ 221: '}',
+ 220: '|',
+ 188: '<',
+ 190: '>',
+ 191: '?',
+ 59: ':',
+ 222: '"'
+ }
+ }
+ var retval = lastChance[x];
+ x6.console.log("Found 'last chance' character, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
+ }
+ // otherwise put on any prefixes and return
+ return retval;
+ },
+
+ keyIsNumeric: function(e) {
+ var keyLabel = this.keyLabel(e);
+ var numbers = [ '0','1','2','3','4','5','6','7','8','9' ];
+ return numbers.indexOf(keyLabel)>=0;
+ },
+
+ keyIsMeta: function(e) {
+ var code = e.keyCode || e.charCode;
+ return typeof(this.metaKeys[code])!='undefined';
+ }
}
/* **************************************************************** *\
@@ -549,7 +742,6 @@
this.retvals[eventName] = true;
for(var x=0; x<subscribers.length;x++) {
var id = subscribers[x];
- x6.console.log("type of id: ",typeof(id));
x6.console.log("subscriber: ",id);
var subscriber = u.byId(id);
if(subscriber==null) {
@@ -641,25 +833,27 @@
// KFD/JD IE event compatibility
e = e ? e : window.event;
inp = inp ? inp : e.srcElement;
- x6.console.group('Input keyDown ');
- x6.console.log("I am in input keydown ",inp,e);
+ x6.console.group('Input keyDown, input and event follow.');
x6.console.log(inp);
x6.console.log(e);
- var keyLabel=u.keyLabel(e);
+ var keyLabel=x6.keyLabel(e);
var isTab =keyLabel=='Tab' || keyLabel=='ShiftTab';
var isEnter =keyLabel=='Enter' || keyLabel=='ShiftEnter';
var isMeta =u.keyIsMeta(e);
var isNav =isEnter || isTab;
- x6.console.log("label ",keyLabel,' isTab ',isTab,' isEnter ',isEnter,' isMeta ',isMeta,' isNav ',isNav);
+ x6.console.log("label: " ,keyLabel);
+ x6.console.log('isTab: ' ,isTab );
+ x6.console.log('isEnter: ',isEnter );
+ x6.console.log('isMeta: ' ,isMeta );
+ x6.console.log('isNav: ' ,isNav );
// All meta keys return true immediately except TAB and ENTER
if(isMeta && !isNav) {
- x6.console.log("input keydown key: ",keyLabel);
var handUpList = ['UpArrow','DownArrow','PageUp','PageDown'];
if(handUpList.indexOf(keyLabel)>=0) {
+ x6.console.log("This key may be passed up to doc handler.");
// An explicit flag can prevent handing events up
if(u.p(inp,'xNoPassup','N')=='N') {
- // If there is an open x6select, do not hand up
if(x6inputs.x6select.div) {
if(keyLabel == 'DownArrow') {
x6inputs.x6select.display(inp,'Down');
@@ -669,10 +863,12 @@
}
}
else {
- x6.console.log("Weird key that we pass up to doc-level keyPress");
+ u.bb.vgfSet('noKeyPress',true);
+ x6.console.log("Going to doc keypress dispatcher.");
var retval= x6.keyDispatcher(e);
}
}
+ console.log("About to call groupEnd");
x6.console.groupEnd();
return retval;
}
@@ -716,6 +912,7 @@
x6.console.log("Not nav key, doing type validation");
if(u.p(inp,'xLookup','N')=='Y') {
x6.console.log("This is a lookup input, allowing everything");
+ x6.console.groupEnd();
return true;
}
type = u.p(inp,'xtypeid');
@@ -727,7 +924,7 @@
case 'numb':
case 'money':
x6.console.log("type validation for numb/money");
- if(!u.keyIsNumeric(e) && u.keyLabel(e)!='.') return false;
+ if(!u.keyIsNumeric(e) && x6.keyLabel(e)!='.') return false;
break;
case 'date':
x6.console.log("type validation for date");
@@ -1252,7 +1449,7 @@
// If still here, we have values and descriptions
var retval = '<table><thead><tr>';
var descs = u.p(input,'xTitles').split('|');
- for(var idx in descs) {
+ for(var idx=0; idx<descs.length; idx++) {
retval+='<th>'+descs[idx]+'</th>';
}
retval+='<th> ';
@@ -1285,10 +1482,10 @@
x6.console.log(svals);
retval = '';
var rows = svals.split('||');
- for(var idx in rows) {
+ for(var idx=0;idx<rows.length;idx++) {
retval += '<tr>';
var values = rows[idx].split('|');
- for(var idx2 in values) {
+ for(var idx2=0;idx2 < values.length; idx2++) {
retval+= '<td>'+values[idx2];
}
}
@@ -1313,10 +1510,10 @@
curVal = jqCandidate[0].innerHTML;
}
- for(var idx in rows) {
+ for(var idx=0; idx < rows.length; idx++) {
retval += '<tr>';
var values = rows[idx];
- for(var idx2 in values) {
+ for(var idx2=0; idx2 < values.length; idx2++) {
if(values[idx2] == null) {
retval+= '<td> ';
}
@@ -1804,7 +2001,7 @@
else {
var retval = 'fail';
var errors = [ ];
- for(var idx in ua.json.jdata.error) {
+ for(var idx = 0; idx < ua.json.jdata.error.length; idx++) {
if(ua.json.jdata.error[idx].slice(0,8)!='(ADMIN):') {
errors.push(ua.json.jdata.error[idx]);
}
@@ -2389,6 +2586,7 @@
var html = "<div id='"+this.zTable+"_0' style='display:none'>"
+ this.zRowEditHtml
+ "</div>";
+ // Here we have an object, not an array, so we iterate by name?
for(var idx in this.zColsById) {
html = html.replace('*VALUE_'+idx+'*','');
}
@@ -2790,7 +2988,7 @@
"<div id='"+this.rowId(row.skey,true)+"'"
+" style='display:none'>";
var numbers = [ 'int', 'numb', 'money' ];
- for (var idx in this.zColsInfo) {
+ for (var idx=0; idx<this.zColsInfo.length; idx++) {
var colInfo = this.zColsInfo[idx];
if(colInfo.column_id == '') continue;
@@ -2809,7 +3007,7 @@
$(this.rowId(skey)).fadeIn();
}
else {
- for(var idx in this.zColsInfo) {
+ for (var idx=0; idx<this.zColsInfo.length;idx++) {
var col = this.zColsInfo[idx].column_id;
if(col!='') {
//var str="#row_"+skey+" div[gColumn="+idx+"]";
@@ -2915,7 +3113,7 @@
self['receiveEvent_uiShowErrors_'+table] = function(errors) {
x6.console.group("tabDiv uiShowErrors");
x6.console.log(errors);
- for(var idx in errors) {
+ for(var idx=0; idx<errors.length; idx++) {
x6.console.log(errors[idx]);
var aError = errors[idx].split(':');
var column = aError[0];
@@ -2956,10 +3154,10 @@
x6events.fireEvent('reqNewRow_'+this.zTable,true);
}
}
- return false;
//x6events.retvals['key_UpArrow'] =false;
x6.console.log("tabDiv key_UpArrow finished");
x6.console.groupEnd();
+ return false;
}
self.receiveEvent_key_DownArrow = function(e) {
x6.console.group("tabDiv key_DownArrow");
@@ -3145,7 +3343,7 @@
];
self.keyboardOn = function() {
if(this.keyboardStatus=='On') return;
- for(var key in this.keyList) {
+ for(var key=0; key<this.keyList.length; key++) {
var keyLabel = this.keyList[key];
x6events.subscribeToEvent('key_'+keyLabel,id);
}
@@ -3154,7 +3352,7 @@
}
self.keyboardOff = function() {
if(this.keyboardStatus=='Off') return;
- for(var key in this.keyList) {
+ for(var key=0; key<this.keyList.length; key++) {
var keyLabel = this.keyList[key];
x6events.unsubscribeToEvent('key_'+keyLabel,id);
}
@@ -3556,7 +3754,7 @@
x6events.subscribeToEvent('uiEditRow_'+table,id);
self['receiveEvent_uiEditRow_'+table] = function(x) {
var kids = u.p(this,'kids').split('|');
- for(var kid in kids) {
+ for(var kid=0; kid < kids.length; kid++) {
var pieces = kids[kid].split(':');
var table_chd = pieces[0];
var display = pieces[1]; // assume 'checkbox'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-01 00:36:27
|
Revision: 1039
http://andro.svn.sourceforge.net/andro/?rev=1039&view=rev
Author: kendowns
Date: 2009-01-01 00:36:23 +0000 (Thu, 01 Jan 2009)
Log Message:
-----------
1) Fix to ie6 compatibility focus commands
2) Included cross-browser compatible selectionStart/End functions
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2008-12-30 23:30:51 UTC (rev 1038)
+++ trunk/andro/clib/x6.js 2009-01-01 00:36:23 UTC (rev 1039)
@@ -60,6 +60,78 @@
createCookie(name,"",-1);
}
+/* **************************************************************** *\
+
+
+ Cross Browser selectionStart/selectionEnd
+ Version 0.2
+ Copyright (c) 2005-2007 KOSEKI Kengo
+
+ This script is distributed under the MIT licence.
+ http://www.opensource.org/licenses/mit-license.php
+
+ Notes from KFD:
+ Explained at: http://www.teria.com/~koseki/memo/xbselection/
+ Download : http://www.teria.com/~koseki/memo/xbselection/Selection.js
+
+\* **************************************************************** */
+
+function Selection(textareaElement) {
+ this.element = textareaElement;
+}
+
+Selection.prototype.create = function() {
+ if (document.selection != null && this.element.selectionStart == null) {
+ return this._ieGetSelection();
+ } else {
+ return this._mozillaGetSelection();
+ }
+}
+
+Selection.prototype._mozillaGetSelection = function() {
+ return {
+ start: this.element.selectionStart,
+ end: this.element.selectionEnd
+ };
+}
+
+Selection.prototype._ieGetSelection = function() {
+ this.element.focus();
+
+ var range = document.selection.createRange();
+ var bookmark = range.getBookmark();
+
+ var contents = this.element.value;
+ var originalContents = contents;
+ var marker = this._createSelectionMarker();
+ while(contents.indexOf(marker) != -1) {
+ marker = this._createSelectionMarker();
+ }
+
+ var parent = range.parentElement();
+ if (parent == null || parent.type != "textarea") {
+ return { start: 0, end: 0 };
+ }
+ range.text = marker + range.text + marker;
+ contents = this.element.value;
+
+ var result = {};
+ result.start = contents.indexOf(marker);
+ contents = contents.replace(marker, "");
+ result.end = contents.indexOf(marker);
+
+ this.element.value = originalContents;
+ range.moveToBookmark(bookmark);
+ range.select();
+
+ return result;
+}
+
+Selection.prototype._createSelectionMarker = function() {
+ return "##SELECTION_MARKER_" + Math.random() + "##";
+}
+
+
/* **************************************************************** *\
@@ -1083,7 +1155,7 @@
if(focusTo) {
x6.console.log("Setting focus forward to ",focusTo);
var str = '[zActive]#'+focusTo;
- x6.jqFocus(str);
+ x6.jqSetFocus(str);
//$('[zActive]#'+focusTo).focus().select();
}
@@ -1108,7 +1180,7 @@
if(focusTo) {
x6.console.log("Setting focus backward to ",focusTo);
var str = '[zActive]#'+focusTo;
- x6.jqFocus(str);
+ x6.jqSetFocus(str);
//$('[zActive]#'+focusTo).focus().select();
}
}
@@ -1298,7 +1370,7 @@
findFocus: function(obj) {
if(typeof(obj)=='string') {
- x6.jqFocus(obj+" :input:first:not([disabled])");
+ x6.jqSetFocus(obj+" :input:first:not([disabled])");
//$(obj+" :input:first:not([disabled])").focus();
}
else {
@@ -1308,11 +1380,11 @@
firstInput: function(inp) {
var xtg = u.p(inp,'xTabGroup','tgdefault');
- x6.jqFocus(":input[xtabgroup="+xtg+"]:not([disabled]):first");
+ x6.jqSetFocus(":input[xtabgroup="+xtg+"]:not([disabled]):first");
},
lastInput: function(inp) {
var xtg = u.p(inp,'xTabGroup','tgdefault');
- x6.jqFocus(":input[xtabgroup="+xtg+"]:not([disabled]):last");
+ x6.jqSetFocus(":input[xtabgroup="+xtg+"]:not([disabled]):last");
},
jqFocusString: function() {
@@ -2600,7 +2672,7 @@
* focus on it.
*/
if(skey==0 && u.bb.vgfGet('lastSave_'+this.zTable)=='noaction') {
- x6.jqFocus(this.rowId(0)+" :input:first:not([disabled])");
+ x6.jqSetFocus(this.rowId(0)+" :input:first:not([disabled])");
x6.console.log("On an empty new row, setting focus");
x6.console.groupEnd();
return;
@@ -2829,11 +2901,11 @@
var focusCandidate = u.bb.vgfGet('lastFocus_'+this.zTable,'');
if(focusCandidate!='') {
var str = this.rowId(skey)+' #'+focusCandidate;
- x6.jqFocus(str);
+ x6.jqSetFocus(str);
}
else {
var str = this.rowId(skey)+" :input:not([disabled]):first";
- x6.jqFocus(str);
+ x6.jqSetFocus(str);
}
}
@@ -3559,7 +3631,7 @@
*/
var str = '#' + ui.panel.id;
str+=' :input:not([disabled]):first';
- x6.jqFocus(str);
+ x6.jqSetFocus(str);
/*
* Save the id and index of the newly shown tab
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-05 15:27:04
|
Revision: 1046
http://andro.svn.sourceforge.net/andro/?rev=1046&view=rev
Author: kendowns
Date: 2009-01-05 15:26:58 +0000 (Mon, 05 Jan 2009)
Log Message:
-----------
Lots of changes to make the conventional profile more stable. Corrected various issues where a user would see child rows for the wrong parent, where visually it would display strange or confusing stuff.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-05 15:25:56 UTC (rev 1045)
+++ trunk/andro/clib/x6.js 2009-01-05 15:26:58 UTC (rev 1046)
@@ -895,6 +895,25 @@
if(value=='null') return '';
return Number(value);
break;
+ case 'dtime':
+ // if value contains decimal seconds, get rid of them
+ if(value.indexOf('.')!=-1) {
+ value = value.slice(0,value.indexOf('.'));
+ }
+ var retval = new Date(value);
+ var hours = retval.getHours();
+ var ampm = 'am';
+ if(hours >= 12) {
+ ampm = 'pm';
+ }
+ if(hours > 12) hours-=12;
+ return retval.getMonth()
+ +"/"+retval.getDate()
+ +"/"+retval.getFullYear()
+ +" "+hours.toString()
+ +":"+retval.getMinutes().toString().pad(2,'0',STR_PAD_LEFT)
+ +" "+ampm;
+ break;
default:
return value;
}
@@ -968,7 +987,6 @@
var retval= x6.keyDispatcher(e);
}
}
- console.log("About to call groupEnd");
x6.console.groupEnd();
return retval;
}
@@ -1286,12 +1304,15 @@
},
setClass: function(inp) {
+ if(u.p(inp,'xLookup')=='Y') return;
+
// If permupd for this table is "N", all controls
// become read only
if(u.bb.vgfGet('permupd_'+u.p(inp,'xTableId'),'')=='N') {
inp.disabled = true;
}
+
// Easiest is disabled controls, remove all classes
if(u.p(inp,'disabled',false)) {
inp.className='';
@@ -1306,7 +1327,7 @@
x6.console.group("setClass for an input "+ux);
x6.console.log(inp);
if(u.p(inp,'zOriginalValue',null)==null) inp.zOriginalValue = '';
- if(inp.value==inp.zOriginalValue) {
+ if(inp.value.trim()==inp.zOriginalValue.trim()) {
inp.zChanged = 0;
}
else {
@@ -1565,6 +1586,7 @@
// is 15 for data and one for titles.
if(u.p(input,'x6rowCount',null)!=null) {
var rowCount = Number(u.p(input,'x6rowCount'));
+ if(rowCount > this.dynRowCount) rowCount = this.dynRowCount;
}
else {
var rowCount = this.dynRowCount;
@@ -2057,7 +2079,6 @@
var jq = ':input[xtableid='+this.zTable+'][zActive]';
x6.console.log("Query string",jq);
$(jq).each(
- //$(this).find(jq).each(
function() {
var col = u.p(this,'xcolumnid');
inpAll[col] = this.value;
@@ -2509,6 +2530,29 @@
$(tabSelector).tabs('select', Number(tabIndex));
}
+ // Create a status message on right if the item exists
+ var sbRight = u.byId('sbr_'+this.zTable);
+ if(sbRight!=null) {
+ var status = '';
+ if(typeof(row.ts_ins)!='undefined') {
+ if(row.uid_ins==null) row.uid_ins = '';
+ status+=typeof(row.uid_ins)!='undefined'
+ ? 'Created ('+row.uid_ins.trim()+'): '
+ : 'Created: ';
+ status += x6dd.display('dtime',row.ts_ins);
+ }
+ if(typeof(row.ts_upd)!='undefined') {
+ if(row.uid_upd==null) row.uid_upd = '';
+ status+=typeof(row.uid_upd)!='undefined'
+ ? ' Changed ('+row.uid_upd.trim()+'): '
+ : ' Changed: ';
+ status += x6dd.display('dtime',row.ts_upd);
+ }
+ sbRight.innerHTML = status;
+ }
+
+
+
x6.console.log("detailDisplay displayRow FINISHED");
x6.console.groupEnd();
return true;
@@ -2525,8 +2569,8 @@
var jqobj =$(this).find(':input[xcolumnid='+colname+']');
if(jqobj.length>0) {
if(val==null) val='';
- jqobj[0].value = val;
- jqobj[0].zOriginalValue = val;
+ jqobj[0].value = val.trim();
+ jqobj[0].zOriginalValue = val.trim();
jqobj[0].zChanged = false;
jqobj[0].zActive = 1;
}
@@ -3517,8 +3561,9 @@
json.addParm('xReturnAll' ,'N');
json.addParm('xGridHeight',u.p(this,'xGridHeight',500));
json.addParm('xLookups' ,u.p(this,'xLookups' ,'N'));
+
if( html = json.execute(false,false,true)) {
- json.process();
+ //json.process();
// The standard path is to take data returned
// by the server and render it. This is safe
// even if the server does not return anything,
@@ -3581,6 +3626,11 @@
// A "kids" profile must do slideup, and get busy turning
// buttons on and off for other tabs.
if(profile=='kids') {
+ // disable all other tabs until we are finished, this is
+ // the easiest way to prevent user from clicking on some
+ // other tab while processing is going on.
+ tabsUl.parentNode.disableAll([ui.index]);
+
// First job for kids is to turn parent stuff on/off
var tablePar = u.p(tabs,'x6parentTable');
if(ui.index > 0) {
@@ -3598,29 +3648,37 @@
var jqTable = $('#'+previousTabId+' [xtableid]:first');
var oldTable = u.p(jqTable[0],'xTableId','');
x6events.fireEvent('buttonsOff_'+oldTable,true);
- $('#'+previousTabId).html('');
+ $('#'+previousTabId+' div[x6plugin=x6tabDiv]').each(
+ function() { this.keyboardOff(); }
+ );
}
-
-
var topPane = u.p(tabs,'x6slideUp');
var tpi = u.p(tabs,'x6slideUpInner');
- x6tabs.slideUp(event,ui,topPane,tpi);
+ x6tabs.slideUp(tabsUl,event,ui,topPane,tpi);
}
// A conventional profile assumes two tabs, first one
// is grid, second one is detail
if(profile=='conventional') {
var table = u.p(tabs,'x6table');
+ var grid = $(tabs).find("div:first div[x6plugin=x6tabDiv]")[0];
if(ui.index==0) {
- var grid = $(ui.panel)
- .find('[x6profile=conventional]')[0];
grid.keyboardOn();
+ x6events.fireEvent('buttonsOff_'+table,true);
- x6events.fireEvent('buttonsOff_'+table,true);
+ // Turn keyboard off for all grids found over on detail side
+ $('#kids_'+table+' div[x6plugin=x6tabDiv]').each(
+ function() { this.keyboardOff(); }
+ );
}
else {
+ grid.keyboardOff();
x6events.fireEvent('buttonsNew_'+table);
+
+ // KFD 1/2/08. Always hide the child tabs when
+ // going back to
+ $("#kids_"+table+" > ul").tabs('select',0);
}
}
@@ -3642,17 +3700,13 @@
},
- slideUp: function(event,ui,topPane,topPaneI) {
+ slideUp: function(tabsUl,event,ui,topPane,topPaneI) {
var obj = u.byId(topPane);
if(typeof(obj.currentChild)=='undefined') obj.currentChild='*';
var currentChild = obj.currentChild
var newChild = ui.panel.id;
- // if UI.index = 0, they clicked hide. We do not have to
- // shrink up the tab because jQuery appears to reset heights
- // on a tab when it is hidden from view. So when the user
- // picks the "hide" tab, all we have to do is pull down
- // the top pane
+ // if UI.index = 0, they clicked hide. Make the
if(ui.index==0) {
if(currentChild!='*') {
var newHeight = $('#'+topPane).height()+350;
@@ -3662,10 +3716,16 @@
);
$('#'+topPane).animate( {height: newHeight},500);
obj.currentChild = '*';
+ tabsUl.parentNode.enableAll();
+ $('#'+currentChild).css('overflow','hidden').height(3);
return true;
}
}
+ // Make the current tab effectively invisible
+ $(ui.panel).css('overflow','hidden').height(3);
+
+
// If no tab, slide up and slide down
if(currentChild=='*') {
var newHeight = $('#'+topPane).height()-350;
@@ -3678,18 +3738,12 @@
);
},100);
$('#'+topPane).animate( {height: newHeight},500 );
- //$('#'+topPane).animate( {height: newHeight},500,null
- // ,function() {
- // $(this).css('overflow-y','scroll');
- // }
- //);
- // Originally I had this in after the toppane scrolled
- // up, but it looks cooler if it happens a little bit
- // after.
var newHeight=$(ui.panel).height()+350;
setTimeout(function() {
$(ui.panel).animate({height: newHeight},500,null
- ,function() { x6tabs.slideUpData(newChild,newHeight) }
+ ,function() {
+ x6tabs.slideUpData(tabsUl,newChild,newHeight);
+ }
);
},200);
u.byId(topPane).currentChild = newChild;
@@ -3704,36 +3758,54 @@
var newHeight=$(ui.panel).height()+350;
setTimeout(function() {
$(ui.panel).animate({height: newHeight},500,null
- ,function() { x6tabs.slideUpData(newChild,newHeight) }
+ ,function() {
+ x6tabs.slideUpData(tabsUl,newChild,newHeight);
+ }
);
+ $('#'+currentChild).css('overflow','hidden').height(3);
},100);
u.byId(topPane).currentChild = newChild;
return true;
},
- slideUpData: function(paneId,newHeight) {
+ slideUpData: function(tabsUl,paneId,newHeight) {
var pane = u.byId(paneId);
var tablePar = u.p(pane,'x6tablePar');
var table = u.p(pane,'x6table' );
var skeyPar = u.bb.vgfGet('skey_'+tablePar);
- var json = new androJSON( 'x6page' ,table );
- json.addParm('x6action' ,'browseFetch');
- json.addParm('tableIdPar',tablePar );
- json.addParm('skeyPar' ,skeyPar );
- json.addParm('sendGrid' ,1 );
- json.addParm('xSortable' ,'Y' );
- json.addParm('xReturnAll','Y' );
- json.addParm('xGridHeight',newHeight-2 ); // assume borders
- x6.console.log(json);
- //html = json.execute(false,false,true);
- //pane.innerHTML = html;
- //var tabDiv = $(pane).find('[x6plugin=x6tabDiv]')[0];
- //x6plugins.x6tabDiv(tabDiv,tabDiv.id,table);
- if(json.execute()) {
- json.process(paneId);
- //var id = $(pane).find("div")[0].id;
- //x6.initOne(id);
+
+ // KFD 1/2/08. Get smarter. If we already loaded a grid
+ // for a child table for current skey, don't
+ // bother doing it again.
+ var skeyDid = u.bb.vgfGet('skey_'+tablePar+'_'+table,0);
+ if(skeyDid==skeyPar) {
+ tabsUl.parentNode.enableAll();
+ x6events.fireEvent('buttonsOn_'+table,true);
}
+ else {
+ var json = new androJSON( 'x6page' ,table );
+ json.addParm('x6action' ,'browseFetch');
+ json.addParm('tableIdPar' ,tablePar );
+ json.addParm('skeyPar' ,skeyPar );
+ json.addParm('sendGrid' ,1 );
+ json.addParm('xSortable' ,'Y' );
+ json.addParm('xReturnAll' ,'Y' );
+ json.addParm('xGridHeight',newHeight-2 ); // assume borders
+ x6.console.log(json);
+ //html = json.execute(false,false,true);
+ //pane.innerHTML = html;
+ //var tabDiv = $(pane).find('[x6plugin=x6tabDiv]')[0];
+ //x6plugins.x6tabDiv(tabDiv,tabDiv.id,table);
+ u.dialogs.pleaseWait("Retrieving Data...");
+ if(json.execute()) {
+ json.process(paneId);
+ //var id = $(pane).find("div")[0].id;
+ //x6.initOne(id);
+ }
+ u.bb.vgfSet('skey_'+tablePar+'_'+table,skeyPar);
+ tabsUl.parentNode.enableAll();
+ u.dialogs.clear();
+ }
}
}
@@ -3743,6 +3815,26 @@
self.jqId = '#'+id+' > ul';
var x6profile = u.p(self,'x6profile');
+
+ self.disableAll = function(exceptions) {
+ if(exceptions==null) exceptions = [ ];
+ var count = $(this.jqId+" > li").length;
+ for(x = 0;x < count; x++) {
+ if(exceptions.indexOf(x)==-1) {
+ $(this.jqId).tabs('disable',x);
+ }
+ }
+ }
+ self.enableAll = function(exceptions) {
+ if(exceptions==null) exceptions = [ ];
+ var count = $(this.jqId+" > li").length;
+ for(x = 0;x < count; x++) {
+ if(exceptions.indexOf(x)==-1) {
+ $(this.jqId).tabs('enable',x);
+ }
+ }
+ }
+
/*
* Always bind the tabsshow event to a generic
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dor...@us...> - 2009-01-11 19:15:22
|
Revision: 1057
http://andro.svn.sourceforge.net/andro/?rev=1057&view=rev
Author: dorgan1983
Date: 2009-01-11 19:15:18 +0000 (Sun, 11 Jan 2009)
Log Message:
-----------
initial support for new jquery based WYSIWYG editor...we should leave FCKEditor in place until we get the new WYSIWYG the way we want it...its fully customizable...
One thing that has to be added so that it dehavoir like other fields during an edit is a way to make it look disabled.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-11 18:23:40 UTC (rev 1056)
+++ trunk/andro/clib/x6.js 2009-01-11 19:15:18 UTC (rev 1057)
@@ -2382,6 +2382,24 @@
x6inputs.disable(this);
}
);
+ $(self).find("textarea").each(
+ function() {
+ if ($(this).attr('xtypeid') == 'mime-h-f' || $(this).attr('xtypeid') == 'mime-h' ) {
+ var el = '#' + $(this).attr('id');
+ $(el).wysiwyg({
+ controls: {
+ separator09: { visible : true },
+ html : {visible : true},
+ separator10: { visible : true },
+ cut : {visible : true},
+ copy : { visible : true },
+ paste : { visible : true },
+ separator07 : { visible : true }
+ }
+ });
+ }
+ }
+ );
}
// detail receives a request to go to a mode which
@@ -2575,6 +2593,17 @@
jqobj[0].zActive = 1;
}
}
+
+ $(self).find("textarea").each(
+ function() {
+ if ($(this).attr('xtypeid') == 'mime-h-f' || $(this).attr('xtypeid') == 'mime-h' ) {
+ var elIFrame = '#' + $(this).attr('id') + 'IFrame';
+ var el = '#' + $(this).attr('id');
+ $($(elIFrame).document()).find('body').html($(el).val());
+ }
+ }
+ );
+
}
if(u.p(self,'x6profile')=='twosides') {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dor...@us...> - 2009-01-11 19:33:38
|
Revision: 1058
http://andro.svn.sourceforge.net/andro/?rev=1058&view=rev
Author: dorgan1983
Date: 2009-01-11 19:33:30 +0000 (Sun, 11 Jan 2009)
Log Message:
-----------
establish differences between mime-h and mime-h-f
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-11 19:15:18 UTC (rev 1057)
+++ trunk/andro/clib/x6.js 2009-01-11 19:33:30 UTC (rev 1058)
@@ -2384,7 +2384,7 @@
);
$(self).find("textarea").each(
function() {
- if ($(this).attr('xtypeid') == 'mime-h-f' || $(this).attr('xtypeid') == 'mime-h' ) {
+ if ($(this).attr('xtypeid') == 'mime-h-f' ) {
var el = '#' + $(this).attr('id');
$(el).wysiwyg({
controls: {
@@ -2397,6 +2397,9 @@
separator07 : { visible : true }
}
});
+ } else if ( $(this).attr('xtypeid') == 'mime-h' ) {
+ var el = '#' + $(this).attr('id');
+ $(el).wysiwyg();
}
}
);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dor...@us...> - 2009-01-11 19:57:05
|
Revision: 1061
http://andro.svn.sourceforge.net/andro/?rev=1061&view=rev
Author: dorgan1983
Date: 2009-01-11 19:56:58 +0000 (Sun, 11 Jan 2009)
Log Message:
-----------
modified WYSIWYG to reflect new blockui and id modifications
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-11 19:56:22 UTC (rev 1060)
+++ trunk/andro/clib/x6.js 2009-01-11 19:56:58 UTC (rev 1061)
@@ -2384,8 +2384,9 @@
);
$(self).find("textarea").each(
function() {
+ var el = '#' + $(this).attr('id');
+ var wysiwyg = el + '_WYSIWYG';
if ($(this).attr('xtypeid') == 'mime-h-f' ) {
- var el = '#' + $(this).attr('id');
$(el).wysiwyg({
controls: {
separator09: { visible : true },
@@ -2398,9 +2399,9 @@
}
});
} else if ( $(this).attr('xtypeid') == 'mime-h' ) {
- var el = '#' + $(this).attr('id');
$(el).wysiwyg();
}
+ $(wysiwyg).block({message: null});
}
);
}
@@ -2602,7 +2603,8 @@
if ($(this).attr('xtypeid') == 'mime-h-f' || $(this).attr('xtypeid') == 'mime-h' ) {
var elIFrame = '#' + $(this).attr('id') + 'IFrame';
var el = '#' + $(this).attr('id');
- $($(elIFrame).document()).find('body').html($(el).val());
+ $($(elIFrame).document()).find('body').html($(el).val());
+ $(el + '_WYSIWYG').unblock();
}
}
);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dor...@us...> - 2009-01-12 03:00:44
|
Revision: 1064
http://andro.svn.sourceforge.net/andro/?rev=1064&view=rev
Author: dorgan1983
Date: 2009-01-12 03:00:40 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
changed default controls for WYSIWYG
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-12 03:00:16 UTC (rev 1063)
+++ trunk/andro/clib/x6.js 2009-01-12 03:00:40 UTC (rev 1064)
@@ -2387,17 +2387,7 @@
var el = '#' + $(this).attr('id');
var wysiwyg = el + '_WYSIWYG';
if ($(this).attr('xtypeid') == 'mime-h-f' ) {
- $(el).wysiwyg({
- controls: {
- separator09: { visible : true },
- html : {visible : true},
- separator10: { visible : true },
- cut : {visible : true},
- copy : { visible : true },
- paste : { visible : true },
- separator07 : { visible : true }
- }
- });
+ $(el).wysiwyg();
} else if ( $(this).attr('xtypeid') == 'mime-h' ) {
$(el).wysiwyg();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-12 15:37:24
|
Revision: 1072
http://andro.svn.sourceforge.net/andro/?rev=1072&view=rev
Author: kendowns
Date: 2009-01-12 15:37:18 +0000 (Mon, 12 Jan 2009)
Log Message:
-----------
Various x6 stuff.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-12 15:36:24 UTC (rev 1071)
+++ trunk/andro/clib/x6.js 2009-01-12 15:37:18 UTC (rev 1072)
@@ -266,7 +266,7 @@
var str = '?x6page=menu'
+'&x6page_prior='+x6page_prior
+'&x6mod_prior='+x6mod_prior;
- window.location.replace(str);
+ //window.location.replace(str);
}
,10
);
@@ -476,7 +476,7 @@
var retval = numbers[x - 48];
if(e.ctrlKey) retval = 'Ctrl' + retval;
if(e.altKey) retval = 'Alt' + retval;
- if(e.shiftKey) retval = 'Shift' + retval;
+ //if(e.shiftKey) retval = 'Shift' + retval;
x6.console.log("Found number, returning: ",retval);
x6.console.groupEnd();
return retval;
@@ -845,7 +845,9 @@
x6.console.log("subscriber: ",id);
var subscriber = u.byId(id);
if(subscriber==null) {
- u.error("There is no object with that ID, cannot dispatch");
+ x6.console.error(
+ "There is no object with that ID, cannot dispatch"
+ );
continue;
}
@@ -857,7 +859,7 @@
x6.console.log(id,eventName,retval);
}
else {
- u.error("Subscriber has no method: ",method);
+ u.error("Subscriber "+subscriber.id+" has no method: "+method);
}
if(retval==false) {
x6.console.log('id returned false, setting false');
@@ -970,6 +972,9 @@
if(isMeta && !isNav) {
var handUpList = ['UpArrow','DownArrow','PageUp','PageDown'];
if(handUpList.indexOf(keyLabel)>=0) {
+ // If we are passing it up or not, it should not be
+ // handled by the doc level, so we suppress it.
+ u.bb.vgfSet('noKeyPress',true);
x6.console.log("This key may be passed up to doc handler.");
// An explicit flag can prevent handing events up
if(u.p(inp,'xNoPassup','N')=='N') {
@@ -982,7 +987,6 @@
}
}
else {
- u.bb.vgfSet('noKeyPress',true);
x6.console.log("Going to doc keypress dispatcher.");
var retval= x6.keyDispatcher(e);
}
@@ -1066,6 +1070,7 @@
// fetch from the server.
if(u.p(inp,'x6select','N')=='Y' && u.p(inp,'xValues',null)==null) {
// Generate the value to send back
+ x6.console.group("An x6select, fetching from Server");
var val = inp.value;
var val = val.slice(0,inp.selectionStart)
+keyLabel
@@ -1080,6 +1085,7 @@
json.execute(true);
//x6inputs.x6select.display(inp);
x6inputs.x6select.displayDynamic(inp,ua.data.x6select);
+ x6.console.groupEnd();
}
// Yet another possibility is a lookup on a set
@@ -1172,7 +1178,9 @@
);
if(focusTo) {
x6.console.log("Setting focus forward to ",focusTo);
- var str = '[zActive]#'+focusTo;
+ // KFD 1/8/08. zActive MARK
+ //var str = '[zActive]#'+focusTo;
+ var str = '#'+focusTo;
x6.jqSetFocus(str);
//$('[zActive]#'+focusTo).focus().select();
}
@@ -1622,11 +1630,17 @@
},
displayDynamic: function(input,rows) {
+ x6.console.group("In x6input.s6select.displayDynamic");
+ x6.console.log(input);
+ x6.console.log(rows);
+ window.rows = rows;
// Begin by determining if we will show or hide
retval = ''
if(rows.length==0) {
+ x6.console.log("There are no rows, hiding display");
this.hide();
//this.tbody.innerHTML = '';
+ x6.console.groupEnd();
return;
}
this.display(input);
@@ -1638,10 +1652,11 @@
curVal = jqCandidate[0].innerHTML;
}
- for(var idx=0; idx < rows.length; idx++) {
+ var rows_length = rows.length;
+ for(var idx in rows) {
retval += '<tr>';
var values = rows[idx];
- for(var idx2=0; idx2 < values.length; idx2++) {
+ for(var idx2 in values) {
if(values[idx2] == null) {
retval+= '<td> ';
}
@@ -1676,6 +1691,7 @@
window.x = this.tbody;
$(this.tbody).find('td:first').mouseover();
}
+ x6.console.groupEnd();
},
mouseEvents: function(input) {
@@ -2078,10 +2094,12 @@
var cntChg = 0;
var jq = ':input[xtableid='+this.zTable+'][zActive]';
x6.console.log("Query string",jq);
+ var rowOld = { };
$(jq).each(
function() {
var col = u.p(this,'xcolumnid');
inpAll[col] = this.value;
+ rowOld[col] = u.p(this,'zOriginalValue','').trim();
var oval = u.p(this,'zOriginalValue','').trim();
if(this.value.trim()!= oval) {
inpChg[col] = this.value.trim();
@@ -2089,6 +2107,7 @@
}
}
);
+ u.bb.vgfSet('rowOld_'+this.zTable,rowOld);
x6.console.log("All inputs: ",inpAll);
x6.console.log("Changed inputs: ",inpChg);
x6.console.log("Count of changes: ",cntChg);
@@ -2143,6 +2162,13 @@
// If save went ok, notify any ui elements, then
// fire off a cache save also if required.
if(retval=='success') {
+ // KFD 1/8/09, fire a delta of the row
+ x6events.fireEvent(
+ 'rowDelta_'+this.zTable
+ ,{rowOld:rowOld, rowNew:$a.data.row}
+ );
+
+
x6.console.log(retval);
x6events.fireEvent('uiRowSaved_'+table,$a.data.row);
if(this.zCache) {
@@ -2269,7 +2295,6 @@
*/
x6events.subscribeToEvent('dbFetchRow_'+table,id);
self['receiveEvent_dbFetchRow_'+table] = function(skey) {
-
if(typeof(this.zRows[skey])=='undefined') {
x6.console.log("tableController bbRow, no row found, fetching");
ua.json.init('x6page',this.zTable);
@@ -2277,12 +2302,14 @@
ua.json.addParm('x6w_skey',skey);
if(ua.json.execute(true)) {
u.bb.vgfSet('dbRow_'+this.zTable,a.data.row);
+ var rowNew = a.data.row;
}
}
else {
x6.console.log("tableController bbRow, publishing row "+skey);
x6.console.log("putting onto bb as dbRow_"+this.zTable);
u.bb.vgfSet('dbRow_'+this.zTable,this.zRows[skey]);
+ var rowNew = this.zRows[skey];
}
}
@@ -2381,8 +2408,8 @@
function() {
x6inputs.disable(this);
}
- );
- $(self).find("textarea").each(
+ )
+ .find("textarea").each(
function() {
var el = '#' + $(this).attr('id');
var wysiwyg = el + '_WYSIWYG';
@@ -2626,6 +2653,7 @@
},
mouseover: function(rowDiv) {
+ if(rowDiv == null) return;
if(!this.mouseEnabled) return false;
if(!rowDiv.id) return false;
if(rowDiv.className=='selected') return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-14 17:11:26
|
Revision: 1079
http://andro.svn.sourceforge.net/andro/?rev=1079&view=rev
Author: kendowns
Date: 2009-01-14 17:11:14 +0000 (Wed, 14 Jan 2009)
Log Message:
-----------
Moved all androLib.js dependencies into x6.js, x6 no longer loads androLib.js
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-12 20:59:14 UTC (rev 1078)
+++ trunk/andro/clib/x6.js 2009-01-14 17:11:14 UTC (rev 1079)
@@ -27,6 +27,7 @@
window.androIsIE = false;
}
+
/* **************************************************************** *\
Cookie functions.
@@ -131,7 +132,341 @@
return "##SELECTION_MARKER_" + Math.random() + "##";
}
+/* **************************************************************** *\
+ Javasript Language Extensions
+
+\* **************************************************************** */
+
+
+/****M* Javascript-API/Date-Extensions
+*
+* NAME
+* Date-Extensions
+*
+* FUNCTION
+* Javascript lacks a handful of useful date functions,
+* such as returning the day of the week as a string.
+* These extensions to the Date object provide those
+* facilities.
+*
+******
+*/
+
+/****m* Date-Extensions/getDow
+*
+* NAME
+* Date.getDow
+*
+* FUNCTION
+* The Javascript method Date.getDow returns the day of
+* the week as a string.
+*
+* If logical true is passed for the first parameter,
+* a 3-digit abbreviation is returned, using 'Thu' for
+* Thursday.
+*
+* INPUTS
+* boolean - If true, returns a 3-digit abbreviation
+*
+*
+* SOURCE
+*
+*/
+Date.prototype.getDow = function(makeItShort) {
+ var days = ['Sunday','Monday','Tuesday','Wednesday'
+ ,'Thursday','Friday','Saturday'
+ ];
+ var retval = days[this.getDay()];
+ if(makeItShort) {
+ return retval.slice(0,3);
+ }
+ return retval;
+}
+/******/
+
+
+/****M* Javascript-API/String-Extensions
+*
+* NAME
+* String-Extensions
+*
+* FUNCTION
+* Javascript lacks a handful of useful string functions,
+* such as padding and trimming, which we have added
+* to our standard library.
+*
+******
+*/
+
+
+/****m* String-Extensions/trim
+*
+* NAME
+* String.trim
+*
+* FUNCTION
+* The Javascript function trim removes leading and trailing
+* spaces from a string.
+*
+* EXAMPLE
+* Example usage:
+* var x = ' abc ';
+* var y = x.trim(); // returns 'abc'
+*
+* SOURCE
+*/
+String.prototype.trim = function() {
+ return this.replace(/^\s+|\s+$/g,"");
+}
+/******/
+
+/****m* String-Extensions/ltrim
+*
+* NAME
+* String.ltrim
+*
+* FUNCTION
+* The Javascript function ltrim removes leading spaces
+* from a string (spaces on the left side).
+*
+* EXAMPLE
+* Example usage:
+* var x = ' abc ';
+* var y = x.ltrim(); // returns 'abc '
+*
+* SOURCE
+*/
+String.prototype.ltrim = function() {
+ return this.replace(/^\s+/,"");
+}
+/******/
+
+/****m* String-Extensions/rtrim
+*
+* NAME
+* String.rtrim
+*
+* FUNCTION
+* The Javascript function rtrim removes trailing spaces
+* from a string (spaces on the right side).
+*
+* EXAMPLE
+* Example usage:
+* var x = ' abc ';
+* var y = x.ltrim(); // returns ' abc'
+*
+* SOURCE
+*/
+String.prototype.rtrim = function() {
+ return this.replace(/\s+$/,"");
+}
+/******/
+
+
+/****m* String-Extensions/pad
+*
+* NAME
+* String.pad
+*
+* FUNCTION
+* The Javascript function pad pads out a string to a given
+* length on either left or right with any character.
+*
+* INPUTS
+* int - the size of the resulting string
+*
+* string - the string that should be added. You can provide
+* a string of more than one character. The resulting string
+* will be clipped to ensure it is returned at the requested
+* size.
+*
+* character - either an 'L' or left padding or an 'R' for
+* right padding.
+*
+* EXAMPLE
+* Example usage:
+* var x = 'abc';
+* var y = x.pad(6,'0','L'); // returns '000abc';
+*
+* SOURCE
+*/
+String.prototype.pad = function(size,character,where) {
+ var val = this;
+ while(val.length < size) {
+ if(where == 'L')
+ val = character + val;
+ else
+ val += character;
+ if(val.length > size) {
+ val = val.slice(0,size);
+ }
+ }
+ return val;
+}
+/******/
+
+
+// Taken from http://www.sourcesnippets.com/javascript-string-pad.html
+var STR_PAD_LEFT = 1;
+var STR_PAD_RIGHT = 2;
+var STR_PAD_BOTH = 3;
+
+String.prototype.strpad = function(str, len, pad, dir) {
+
+ str = String(str);
+ if (typeof(len) == "undefined") { var len = 0; }
+ if (typeof(pad) == "undefined") { var pad = ' '; }
+ if (typeof(dir) == "undefined") { var dir = STR_PAD_RIGHT; }
+
+ if (len + 1 >= str.length) {
+
+ switch (dir){
+
+ case STR_PAD_LEFT:
+ str = Array(len + 1 - str.length).join(pad) + str;
+ break;
+
+ case STR_PAD_BOTH:
+ var right = Math.ceil((padlen = len - str.length) / 2);
+ var left = padlen - right;
+ str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
+ break;
+
+ default:
+ str = str + Array(len + 1 - str.length).join(pad);
+ break;
+
+ } // switch
+
+ }
+
+ return str;
+
+}
+
+String.prototype.pad = function(len, pad, dir) {
+
+ str = this.toString();
+ if (typeof(len) == "undefined") { var len = 0; }
+ if (typeof(pad) == "undefined") { var pad = ' '; }
+ if (typeof(dir) == "undefined") { var dir = STR_PAD_RIGHT; }
+
+ if (len + 1 >= str.length) {
+
+ switch (dir){
+
+ case STR_PAD_LEFT:
+ str = Array(len + 1 - str.length).join(pad) + str;
+ break;
+
+ case STR_PAD_BOTH:
+ var right = Math.ceil((padlen = len - str.length) / 2);
+ var left = padlen - right;
+ str = Array(left+1).join(pad) + str + Array(right+1).join(pad);
+ break;
+
+ default:
+ str = str + Array(len + 1 - str.length).join(pad);
+ break;
+
+ } // switch
+
+ }
+
+ return str;
+
+}
+
+/****m* String-Extensions/repeat
+*
+* NAME
+* String.repeat
+*
+* FUNCTION
+* The Javascript function repeat returns the input string
+* repeated any number of times
+*
+* INPUTS
+* * int - the number of times to repeat the string.
+*
+*
+* EXAMPLE
+* Example usage:
+* alert( 'abc'.repeat(3));
+*
+* SOURCE
+*/
+String.prototype.repeat = function(count) {
+ if(count==null) count = 1;
+ retval = '';
+ for(var x = 1; x<= count; x++) {
+ retval+= this;
+ }
+ return retval;
+}
+/******/
+
+/****m* String-Extensions/htmlDisplay
+*
+* NAME
+* String.htmlDisplay
+*
+* FUNCTION
+* The Javascript function htmlDisplay converts the HTML
+* characters ampersand '&', less than '<' and
+* greater-than '>' to their HTML entities equivalents
+* for safe display.
+*
+* The reverse function is htmlEdit.
+*
+* SOURCE
+*/
+String.prototype.htmlDisplay = function() {
+ return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+}
+/******/
+
+/****m* String-Extensions/htmlEdit
+*
+* NAME
+* String.htmlEdit
+*
+* FUNCTION
+* The Javascript function htmlEdit removes HTML entities
+* from a string and replaces them with literal characters,
+* suitable for editing in an input. The characters replaced
+* are ampersand '&', less-than '<', greater-than '>'
+* and non-breaking space '&nbsp;'.
+*
+* SOURCE
+*/
+String.prototype.htmlEdit = function() {
+ return this.replace(/&/g,'&')
+ .replace(/</g,'<')
+ .replace(/>/g,'>')
+ .replace(/ /g,' ');
+}
+/******/
+
+/* ---------------------------------------------------- *\
+
+ FIX BRAIN-DAMAGED INTERNET EXPLORER
+
+\* ---------------------------------------------------- */
+
+if(!Array.indexOf){
+ Array.prototype.indexOf = function(obj){
+ for(var i=0; i<this.length; i++){
+ if(this[i]==obj){
+ return i;
+ }
+ }
+ return -1;
+ }
+}
+
+
/* **************************************************************** *\
@@ -155,9 +490,9 @@
$(document).keydown(function(e) {
//e = e ? e : window.event;
x6.console.group("Document Keydown");
- if(u.bb.vgfGet('noKeyPress',false)==true) {
+ if(x6bb.fwGet('noKeyPress',false)==true) {
x6.console.log("noKeyPress was set, ignoring");
- u.bb.vgfSet('noKeyPress',false);
+ x6bb.fwSet('noKeyPress',false);
}
else {
// no log entry, key dispatcher does that
@@ -173,9 +508,9 @@
// Initialize an object that has been sent from the server
initOne: function(id) {
- var obj = u.byId(id);
- var pin = u.p(obj,'x6plugin');
- obj.zTable = u.p(obj,'x6table');
+ var obj = x6.byId(id);
+ var pin = x6.p(obj,'x6plugin');
+ obj.zTable = x6.p(obj,'x6table');
x6.console.log(pin,obj.zTable);
x6.console.log(obj);
x6plugins[pin](obj,obj.id,obj.zTable);
@@ -200,10 +535,10 @@
else {
var z=0;
while(z < x.length) {
- if(u.p(x[z],'id','').trim()!='') break;
+ if(x6.p(x[z],'id','').trim()!='') break;
z++;
}
- if(u.p(x[z],'id','').trim() !='') {
+ if(x6.p(x[z],'id','').trim() !='') {
x[z].focus();
}
}
@@ -223,7 +558,16 @@
}
}
+ // Trap IE/Firefox refresh buttons so they work
+ // the same on both platforms.
+ if(retval=='ShiftF5' && !window.androIsIE) {
+ window.location.reload(true);
+ }
+ if(retval=='CtrlF5' && window.androIsIE) {
+ window.location.reload(true);
+ }
+
// Make list of keys to stop no matter what
var stopThem = [ 'CtrlF5', 'F10' ];
@@ -231,7 +575,8 @@
'CtrlS', 'CtrlN', 'CtrlI', 'CtrlD',
'CtrlL', 'CtrlO', 'CtrlW', 'CtrlP',
'CtrlQ', 'CtrlR', 'CtrlU', 'CtrlK',
- 'CtrlY'
+ 'CtrlY',
+ 'DownArrow','UpArrow'
];
// Set a flag now. If user hit ESC, we are trying
@@ -239,7 +584,7 @@
// cannot do so.
if(retval=='Esc') {
x6.console.log("Esc key pressed, pre-seting exitApproved=true");
- u.bb.vgfSet('exitApproved',true);
+ x6bb.fwSet('exitApproved',true);
}
// Now we have a complete key label, fire the event
@@ -255,18 +600,18 @@
// for that, because if it came back true we will exit,
// but otherwise we cannot.
if(retval=='Esc') {
- var exitApproved = u.bb.vgfGet('exitApproved',false);
+ var exitApproved = x6bb.fwGet('exitApproved',false);
x6.console.log("Key dispatch, ESC, exitapproved: ",exitApproved);
if(exitApproved) {
x6.console.log("exit for ESC was approved, going to menu");
setTimeout(
function() {
- var x6page_prior=u.p(u.byId('x6page'),'value');
- var x6mod_prior =u.p(u.byId('x6module'),'value');
+ var x6page_prior=x6.p(x6.byId('x6page'),'value');
+ var x6mod_prior =x6.p(x6.byId('x6module'),'value');
var str = '?x6page=menu'
+'&x6page_prior='+x6page_prior
+'&x6mod_prior='+x6mod_prior;
- //window.location.replace(str);
+ window.location.replace(str);
}
,10
);
@@ -293,6 +638,8 @@
return true;
},
+
+
/*
* The console object starts out with do-nothing functions.
* These are replaced if the console object exists.
@@ -537,7 +884,728 @@
keyIsMeta: function(e) {
var code = e.keyCode || e.charCode;
return typeof(this.metaKeys[code])!='undefined';
- }
+ },
+
+ /****m* x6/uniqueId
+ * NAME
+ * x6.uniqueId
+ *
+ * FUNCTION
+ * Generates a random number between 1 and 1,000,000 that is
+ * not being used as the ID for any DOM object. Useful for
+ * generating unique and content-free Id's for DOM objects.
+ *
+ * EXAMPLE
+ * Example usage would be:
+ *
+ * var x = document.createElement('div');
+ * x.id = x6.uniqueId();
+ *
+ * RESULT
+ * id - returns the id
+ *
+ * SOURCE
+ */
+ uniqueId: function() {
+ var retval = 0;
+ while( $('#'+retval).length > 1 || retval==0) {
+ var retval=Math.floor(Math.random()*1000000);
+ }
+ return retval;
+ },
+ /******/
+
+ /*
+ * KFD 1/13/09. We put this here so we do not have to
+ * load up androLib.js anymore. We will
+ * gradually eliminate use of this function
+ * and make it go away. We will use
+ * $(id)... instead.
+ */
+ byId: function(id) {
+ return document.getElementById(id );
+ },
+
+ p: function(obj,propname,defvalue) {
+ if(typeof(obj)!='object') {
+ return defvalue;
+ }
+
+ // First try, maybe it is a direct property
+ if(typeof(obj[propname])!='undefined') {
+ return obj[propname];
+ }
+ // Second try, maybe it is an attribute
+ if(obj.getAttribute) {
+ if(obj.getAttribute(propname)!=null) {
+ return obj.getAttribute(propname);
+ }
+ }
+ // Give up, return the defvalue
+ return defvalue;
+ },
+
+ openWindow: function(url) {
+ window.open(url);
+ },
+
+ /****O* ua/json
+ *
+ * NAME
+ * x6.json
+ *
+ * FUNCTION
+ * The Javascript object x6.json is used to send any request
+ * to the web server, either for a new complete page or for
+ * data and HTML fragments.
+ * Examples include requesting a single row from a table,
+ * requesting search results, fetching HTML fragments, or
+ * popping up a new window.
+ *
+ * Andromeda uses the term JSON instead of AJAX because
+ * the term AJAX does not describe how Andromeda works.
+ * Specifically, Andromeda PHP pages return JSON data
+ * instead of XML (hence no "X" in AJA"X"), and many calls
+ * are actually synchronous (hence no "A" in "A"JAX).
+ *
+ * The x6.json object is always present on all pages, and
+ * you can use it in Javascript code on any custom page.
+ *
+ * NOTES
+ * Andromeda handles all of the values returned in the
+ * request automatically. On custom pages you do not have
+ * to code a response handler because Andromeda handles
+ * the response for you.
+ *
+ * The PHP code that handles a JSON request sends data back
+ * by using the routines x4Debug, x4Data, x4HTML, x4Script,
+ * x4Error. While the complete PHP-API documentation on
+ * those functions will give you most of what you need, we
+ * must note here how the returned data is handled:
+ * * x4Debug - ignored, but you can examine the results in
+ * firebug.
+ * * x4Error - any errors sent back by this function are reported
+ * to the user and x6.json.execute returns false.
+ * * x4HTML - calls to this function in PHP code provide an
+ * element Id and a fragment of HTML. The HTML replaces the
+ * innerHTML of the specific item.
+ * * x4Data - calls to this function in PHP code provide a name
+ * and some data value (including arrays and objects). The
+ * result can be examined when the call completes in x6.data.<name>.
+ * * x4Script - provides script that should execute on the browser
+ * when the call returns.
+ *
+ * EXAMPLE
+ *
+ * The basic usage of x6.json is to initialize a call
+ * with x6.json.init, and then to add parameters with
+ * x6.json.addParm, and finally to execute and process the
+ * call with x6.json.execute and x6.json.process.
+ *
+ * There are also special-purpose methods like x6.json.inputs
+ * that will take all of the inputs inside of an object and
+ * add them to the request.
+ *
+ * You can also use the function x6.json.windowLocation to
+ * execute the call as a new page request, and x6.json.newWindow
+ * to execute the call as a new page request in a tab.
+ *
+ * <script>
+ * // Initialize the call
+ * x6.json.init('x4Page','myCustomPage');
+ * // Name the server-side PHP method to call
+ * x6.json.addParm('x4Action','getSomething');
+ * // Add some parms
+ * x6.json.addParm('parm1','value');
+ * x6.json.addParm('parm2','value');
+ * // Execute and process in one step. Note that this
+ * // is synchronous, there is no need for a callback
+ * // function.
+ * x6.json.execute(true);
+ *
+ * for(var x in x6.data.returnedStuff) {
+ * ....
+ * }
+ * </script>
+ *
+ * This call requires an Extended-Desktop page to be defined
+ * in PHP that will service the request. A super-simple example
+ * is here, more information is provided in the
+ * Extended-Desktop documentation.
+ *
+ * <?php
+ * # This is file application/x4MyCustomPage.php
+ * class x4MyCustomPage extends androX4 {
+ * # this function handles the call given above
+ * function getSomething() {
+ * $parm1 = gp('parm1');
+ * $parm2 = gp('parm2');
+ * $sql = "Select blah blah blah";
+ * $rows = SQL_AllRows($sql);
+ * x4Data('returnedStuff',$rows
+ * }
+ * }
+ * ?>
+ *
+ * Sometimes you make a call that returns replacement HTML
+ * for a single object. In this case your PHP code supplies
+ * the HTML by calling x4HTML with the value of '*MAIN*' for
+ * the first parameter, as in x4HTML('*MAIN*',$html);
+ * Such a call is handled this way in script:
+ *
+ * <script>
+ * x6.json.init('x4Page','myCustomPage');
+ *
+ * // We need the conditional in case the server returns
+ * // an error and we should not replace the html
+ * if(x6.json.execute()) {
+ * x6.json.process('nameofItemToReplace');
+ * }
+ * </script>
+ *
+ ******
+ */
+ data: { }, // required for json
+ json: {
+ callString: '',
+ http: false,
+ active: false,
+ jdata: { },
+ data: { dd: {} },
+ requests: { },
+ parms: { },
+ reportErrors: true,
+ x4Page: '',
+ x4Action: '',
+ explicitParms: '',
+ hadErrors: false,
+
+ /****m* json/init
+ *
+ * NAME
+ * x6.json.init
+ *
+ * FUNCTION
+ * The Javascript method x6.json.init initiates a new
+ * JSON request.
+ *
+ * Optionally you can pass two inputs and eliminate one
+ * call to x6.json.addParm.
+ *
+ * INPUTS
+ * string - if provided, a parameter name
+ * mixed - if provided, the value for the parameter
+ *
+ * EXAMPLE
+ * Here are two examples for initiating a JSON request
+ *
+ * <script>
+ * // The short way
+ * x6.json.init('x4Page','myCustomPage');
+ *
+ * // Passing w/o parameters requires at least one
+ * // call to x6.json.addParm.
+ * x6.json.init();
+ * x6.json.addParm('x4Page','myCustomPage');
+ * </script>
+ *
+ * SOURCE
+ */
+ init: function(name,value) {
+ this.x4Page = '';
+ this.x4Action = '';
+ this.callString = '';
+ this.parms = { };
+ this.reportErrors=true;
+ this.explicitParms= '';
+ if(name!=null) {
+ this.addParm(name,value);
+ }
+ },
+ /******/
+
+ /****** json/addParm
+ *
+ * NAME
+ * x6.json.addParm
+ *
+ * FUNCTION
+ * The Javascript method x6.json.addParm adds one parameter
+ * to a JSON call previously initiated with x6.json.init.
+ *
+ * INPUTS
+ * string - required, a parameter name
+ * mixed - required, the value for the parameter
+ *
+ * EXAMPLE
+ * Here are two examples for initiating a JSON request
+ *
+ * <script>
+ * x6.json.init();
+ * // Name the server-side page to call
+ * x6.json.addParm('x4Page','myCustomPage');
+ * // Name the server-side method to call
+ * x6.json.addParm('x4Action','fetchSomething');
+ * </script>
+ *
+ * SOURCE
+ */
+ addParm: function(name,value) {
+ this.parms[name] = value;
+ if(name=='x4Page') this.x4Page = value;
+ if(name=='x4Action') this.x4Action = value;
+ },
+ /******/
+
+ makeString: function() {
+ if(this.explicitParms!='') {
+ return this.explicitParms;
+ }
+ var list = [ ];
+ for(var x in this.parms) {
+ list[list.length] = x + "=" +encodeURIComponent(this.parms[x]);
+ }
+ return list.join('&');
+ },
+ //addValue: function(name,value) {
+ // if(this.callString!='') this.callString+="&";
+ // this.callString += 'x4c_' + name + '=' + encodeURIComponent(value);
+ //},
+
+ /****** json/inputs
+ *
+ * NAME
+ * x6.json.inputs
+ *
+ * FUNCTION
+ * The Javascript method x6.json.inputs adds inputs to
+ * a JSON call previously initiated with x6.json.init.
+ *
+ * This method accepts an object as its parameter, and
+ * will add every input that is a child (at any level)
+ * of that object.
+ *
+ * This method uses the "id" property of the input to
+ * name the parameter, not the "name" property. Andromeda
+ * makes no use of the "name" property.
+ *
+ * This method is equivalent to use x6.json.addParm
+ * for each of the desired inputs.
+ *
+ * Checkboxes receive special treatment. If the box is
+ * checked a value of 'Y' is sent, and if the box is not
+ * checked a value of 'N' is sent.
+ *
+ * The name of each parameter is normally the Id of the
+ * input. If the inputs were generated by Andromeda
+ * on an Extended-Desktop page, they will have the names
+ * 'x4inp_<tableId>_<columnId>.
+ *
+ * INPUTS
+ * object - optional, the object to recurse. You must
+ * pass the object itself, not its Id. If no object is
+ * passed the Extended-Desktop top-level object x4Top
+ * is used, which means you get every input on the page,
+ * whether or not it is visible or
+ *
+ * direct - a special flag that says to name the parameters
+ * 'x4c_<columnId>'. This is required when you are sending
+ * Direct-Database-Access calls.
+ *
+ *
+ * SOURCE
+ */
+ inputs: function(obj,direct) {
+ if(direct==null) direct=false;
+ if(obj==null) {
+ if(x6.byId('x4Top')!=null) {
+ obj = x6.byId('x4Top');
+ }
+ else {
+ obj = $('.x6main')[0];
+ }
+ }
+ if(typeof(obj)=='string') {
+ if(obj.indexOf('input')==-1) {
+ var jqObjects = $(obj).find(':input');
+ }
+ else {
+ var jqObjects = $(obj);
+ }
+ }
+ else {
+ var jqObjects = $(obj).find(":input");
+ }
+ jqObjects.each( function() {
+ if(direct)
+ var id = 'x4c_'+x6.p(this,'xColumnId');
+ else
+ var id = this.id;
+
+
+ if(this.type=='checkbox') {
+ if(this.checked) {
+ x6.json.addParm(id,'Y');
+ }
+ else {
+ x6.json.addParm(id,'N');
+ }
+ }
+ else {
+ if(typeof(x6)=='undefined') {
+ if(this.value!='') {
+ x6.json.addParm(id,this.value);
+ }
+ }
+ else {
+ var zOrig = x6.p(this,'zOriginalValue','').trim();
+ if(this.value.trim()!=zOrig) {
+ x6.json.addParm(id,this.value);
+ }
+ }
+ }
+ });
+ },
+ /******/
+
+ /****** json/serialize
+ *
+ * NAME
+ * x6.json.serialize
+ *
+ * FUNCTION
+ * The Javascript method x6.json.serialize takes a
+ * Javascript Object or Array and serializes it and
+ * adds the values to a JSON request previously
+ * initialized with x6.json.init.
+ *
+ * This method accepts an object as its parameter.
+ *
+ * When you call this function, the parameters sent
+ * back take the form of an associative array.
+ *
+ * INPUTS
+ * prefix - The base name of the parameter
+ *
+ * object - the object to serialize.
+ *
+ * EXAMPLE
+ * Consider the following object that is serialized
+ *
+ * <script>
+ * var x = {
+ * parm1: [ 1, 2, 3],
+ * parm2: 'hello',
+ * parm3: {
+ * x: 5,
+ * y: 10,
+ * }
+ * x6.json.init('x4Page','myCustomPage');
+ * x6.json.addParm('x4Action','serialHandler');
+ * x6.json.serialize('example',x);
+ * <script>
+ *
+ * Then on the server, you can grab the "example" parameter
+ * and you will get the following associative array:
+ *
+ * <?php
+ * # this is file x4myCustomPage.php
+ * class x4myCustomPage extends androX4 {
+ *
+ * # this handles the 'x4Action' specified above
+ * function serialHandler() {
+ * $example = gp('example');
+ *
+ * # ...the following code shows how
+ * # the values that are in x4
+ * $example['parm1'][0] = 1;
+ * $example['parm1'][1] = 2;
+ * $example['parm1'][2] = 3;
+ * $example['parm2'] = 'hello';
+ * $example['parm3']['x'] = 5;
+ * $example['parm3']['y'] = 10;
+ * }
+ * }
+ * ?>
+ *
+ * SOURCE
+ */
+ serialize: function(prefix,obj) {
+ for(var x in obj) {
+ if(typeof(obj[x])=='object') {
+ this.serialize(prefix+'['+x+']',obj[x]);
+ }
+ else {
+ this.addParm(prefix+'['+x+']',obj[x]);
+ }
+ }
+ },
+ /******/
+
+ /****** json/windowLocation
+ *
+ * NAME
+ * x6.json.windowLocation
+ *
+ * FUNCTION
+ * The Javascript method x6.json.windowLocation takes a
+ * JSON request and executes it as a page request.
+ *
+ * EXAMPLE
+ * The following example loads a new page
+ *
+ * <script>
+ * x6.json.init('x4Page','calendar');
+ * x6.json.windowLocation();
+ * </script>
+ *
+ * SOURCE
+ */
+ windowLocation: function() {
+ var entireGet = 'index.php?'+this.makeString()
+ window.location = entireGet;
+ },
+ /******/
+
+ /****** json/newWindow
+ *
+ * NAME
+ * x6.json.newWindow
+ *
+ * FUNCTION
+ * The Javascript method x6.json.newWindow takes a
+ * JSON request and executes it as a page request, popping
+ * the result up in a new tab or window.
+ *
+ * When the user exits the resulting tab or window, it
+ * will close.
+ *
+ * EXAMPLE
+ * The following example loads a new page
+ *
+ * <script>
+ * x6.json.init('x4Page','calendar');
+ * x6.json.newWindow();
+ * </script>
+ *
+ * SOURCE
+ */
+ newWindow: function() {
+ var entireGet = 'index.php?'+this.makeString()+'&x4Return=exit';
+ $a.openWindow(entireGet);
+ },
+ /******/
+
+ /****** json/executeAsync
+ *
+ * NAME
+ * x6.json.executeAsync
+ *
+ * FUNCTION
+ * By default Andromeda sends JSON requests synchronously,
+ * which is more appropriate for business database applications
+ * than asynchronous requests.
+ *
+ * ...
[truncated message content] |
|
From: <ken...@us...> - 2009-01-14 19:06:22
|
Revision: 1090
http://andro.svn.sourceforge.net/andro/?rev=1090&view=rev
Author: kendowns
Date: 2009-01-14 19:06:18 +0000 (Wed, 14 Jan 2009)
Log Message:
-----------
X6: Allow calls to conventional pages with pre-filled search criteria
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-14 17:19:22 UTC (rev 1089)
+++ trunk/andro/clib/x6.js 2009-01-14 19:06:18 UTC (rev 1090)
@@ -1392,7 +1392,7 @@
*/
newWindow: function() {
var entireGet = 'index.php?'+this.makeString()+'&x4Return=exit';
- $a.openWindow(entireGet);
+ x6.openWindow(entireGet);
},
/******/
@@ -4326,8 +4326,8 @@
x6.json.addParm('x6action','fetchRow');
x6.json.addParm('x6w_skey',skey);
if(x6.json.execute(true)) {
- x6bb.fwSet('dbRow_'+this.zTable,a.data.row);
- var rowNew = a.data.row;
+ x6bb.fwSet('dbRow_'+this.zTable,x6.data.row);
+ var rowNew = x6.data.row;
}
}
else {
@@ -5704,6 +5704,22 @@
delete json;
x6dialogs.clear();
}
+
+ // Initialization. If we see "search_" inputs that are
+ // not empty, execute the search and pick the first one.
+ if( $(self).find("[id^=search][value!=]").length > 0) {
+ self.fetch();
+ var jqRow = self.jqCurrentRow();
+ if(jqRow.length>0) {
+ var rowId = jqRow[0].id;
+ var aRowId = rowId.split('_');
+ var skey = aRowId.pop();
+ console.log(rowId,aRowId,skey);
+ setTimeout(function() {
+ x6events.fireEvent('reqEditRow_'+table,skey);
+ },900);
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-15 19:48:34
|
Revision: 1097
http://andro.svn.sourceforge.net/andro/?rev=1097&view=rev
Author: kendowns
Date: 2009-01-15 19:48:29 +0000 (Thu, 15 Jan 2009)
Log Message:
-----------
Some corrections to the the code that was copied in from androLib.js
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-15 19:47:51 UTC (rev 1096)
+++ trunk/andro/clib/x6.js 2009-01-15 19:48:29 UTC (rev 1097)
@@ -474,6 +474,24 @@
\* **************************************************************** */
var x6 = {
+ // KFD 1/15/09. The options sub-object will control
+ // various behaviors. The PHP code must
+ // send commands to set options, the javascript
+ // will not try to figure them out or do
+ // anything 'smart'.
+ options: {
+ get: function(optName,defValue) {
+ return typeof(this[optName])=='undefined'
+ ? defValue
+ : this[optName];
+ },
+ set: function(optName,optValue) {
+ this[optName] = optValue;
+ },
+
+ navOnEnter: false
+ },
+
// A list of keyboard events that is allowed when a modal
// dialog is up. False means allow all, an array would list
// what is allowed, and an empty array allows none.
@@ -486,21 +504,46 @@
// Activate a global keyboard handler
// SEE ALSO: input.keyDown(), it must also pass some
// events to keyDispatcher that don't go to
- // the document.keypress from an input
- $(document).keydown(function(e) {
- //e = e ? e : window.event;
- x6.console.group("Document Keydown");
- if(x6bb.fwGet('noKeyPress',false)==true) {
- x6.console.log("noKeyPress was set, ignoring");
- x6bb.fwSet('noKeyPress',false);
- }
- else {
- // no log entry, key dispatcher does that
- var retval= x6.keyDispatcher(e);
- }
- x6.console.groupEnd();
- return retval;
- });
+ // the document.keypress from an input
+ // KFD 1/15/09. Major problem. IE does not recognize keypress
+ // for meta keys at document level, so we have to
+ // use keydown. But firefox has one very specific
+ // problem: if you hit ESC while a control has
+ // focus and change the value of the control in
+ // a document.keydown, it gets changed back!
+ // So firefox must remain keypress and IE keydown
+ if(window.androIsIE) {
+ $(document).keydown(function(e) {
+ //e = e ? e : window.event;
+ x6.console.group("Document Keydown");
+ if(x6bb.fwGet('noKeyPress',false)==true) {
+ x6.console.log("noKeyPress was set, ignoring");
+ x6bb.fwSet('noKeyPress',false);
+ }
+ else {
+ // no log entry, key dispatcher does that
+ var retval= x6.keyDispatcher(e);
+ }
+ x6.console.groupEnd();
+ return retval;
+ });
+ }
+ else {
+ $(document).keypress(function(e) {
+ //e = e ? e : window.event;
+ x6.console.group("Document Keydown");
+ if(x6bb.fwGet('noKeyPress',false)==true) {
+ x6.console.log("noKeyPress was set, ignoring");
+ x6bb.fwSet('noKeyPress',false);
+ }
+ else {
+ // no log entry, key dispatcher does that
+ var retval= x6.keyDispatcher(e);
+ }
+ x6.console.groupEnd();
+ return retval;
+ });
+ }
// Put little buttons next to stuff
$(':input').each(function() { x6inputs.x6select.addButton(this); });
@@ -551,8 +594,8 @@
var retval = x6.keyLabel(e);
// Possible trapping because of modal dialogs
- if(typeof(x6.dialogsAllow)=='object') {
- if(x6.dialogsAllow.indexOf(retval) == -1) {
+ if(typeof(x6dialogsAllow)=='object') {
+ if(x6dialogsAllow.indexOf(retval) == -1) {
e.stopPropagation();
return false;
}
@@ -611,7 +654,7 @@
var str = '?x6page=menu'
+'&x6page_prior='+x6page_prior
+'&x6mod_prior='+x6mod_prior;
- window.location.replace(str);
+ //window.location.replace(str);
}
,10
);
@@ -659,6 +702,7 @@
this.enableProfile=true;
},
enableAll: function() {
+ var retVal = this.enableLog;
this.enableLog = true;
this.enableWarn = true;
this.enableInfo = true;
@@ -666,8 +710,11 @@
this.enableTime = true;
this.enableGroup = true;
this.enableProfile=true;
+ return retVal;
},
- disableAll: function() {
+ disableAll: function(wasEnabled) {
+ if(wasEnabled==null) wasEnabled = false;
+ if(wasEnabled) return;
this.enableLog = false;
this.enableWarn = false;
this.enableInfo = false;
@@ -811,9 +858,12 @@
x6.console.groupEnd();
return retval;
}
-
- // Numbers or the corresponding codes go here
- if(x >= 48 && x <= 57) {
+ else if( x >= 96 && x <= 105 ) {
+ var numbers = [ '0','1','2','3','4','5','6','7','8','9' ];
+ var retval = numbers[x - 96];
+ x6.console.log("number pad number, returning: ",retval);
+ }
+ else if(x >= 48 && x <= 57) {
if(e.shiftKey) {
var numbers = [ ')','!','@','#','$','%','^','&','*','(' ];
}
@@ -823,55 +873,52 @@
var retval = numbers[x - 48];
if(e.ctrlKey) retval = 'Ctrl' + retval;
if(e.altKey) retval = 'Alt' + retval;
- //if(e.shiftKey) retval = 'Shift' + retval;
x6.console.log("Found number, returning: ",retval);
- x6.console.groupEnd();
return retval;
}
- if(retval!='') {
- if(e.ctrlKey) retval = 'Ctrl' + retval;
- if(e.altKey) retval = 'Alt' + retval;
- if(e.shiftKey) retval = 'Shift' + retval;
- x6.console.log("Found letter or number, returning: ",retval);
- x6.console.groupEnd();
- return retval;
- }
-
- var lastChance = {
- 192: '`',
- 109: '-',
- 61: '=',
- 219: '[',
- 221: ']',
- 220: '\\',
- 188: ',',
- 190: '.',
- 191: '/',
- 59: ';',
- 222: "'"
- }
- if(typeof(lastChance[x])!='undefined') {
- if(e.shiftKey) {
- var lastChance = {
- 192: '~',
- 109: '_',
- 61: '+',
- 219: '{',
- 221: '}',
- 220: '|',
- 188: '<',
- 190: '>',
- 191: '?',
- 59: ':',
- 222: '"'
+ else {
+ var lastChance = {
+ 192: '`',
+ 109: '-',
+ 61: '=',
+ 219: '[',
+ 221: ']',
+ 220: '\\',
+ 188: ',',
+ 190: '.',
+ 191: '/',
+ 59: ';',
+ 222: "'",
+ // special keys on number pad follow:
+ 106: '*',
+ 107: '+',
+ 110: '.',
+ 111: '/'
+
+ }
+ if(typeof(lastChance[x])!='undefined') {
+ if(e.shiftKey) {
+ var lastChance = {
+ 192: '~',
+ 109: '_',
+ 61: '+',
+ 219: '{',
+ 221: '}',
+ 220: '|',
+ 188: '<',
+ 190: '>',
+ 191: '?',
+ 59: ':',
+ 222: '"'
+ }
}
+ var retval = lastChance[x];
+ x6.console.log("Found 'last chance' character, returning: ",retval);
+ return retval;
}
- var retval = lastChance[x];
- x6.console.log("Found 'last chance' character, returning: ",retval);
- x6.console.groupEnd();
- return retval;
}
- // otherwise put on any prefixes and return
+
+ x6.console.groupEnd();
return retval;
},
@@ -1520,11 +1567,11 @@
// If there were server errors, report those
if(this.jdata.error.length>0 && this.reportErrors) {
this.hadErrors = true;
- $a.dialogs.alert(this.jdata.error.join("\n\n"));
+ x6dialogs.alert(this.jdata.error.join("\n\n"));
return false;
}
if(this.jdata.notice.length>0 && this.reportErrors) {
- $a.dialogs.alert(this.jdata.notice.join("\n\n"));
+ x6dialogs.alert(this.jdata.notice.join("\n\n"));
}
if(autoProcess) {
@@ -1605,7 +1652,7 @@
return true;
}
- },
+ }
}
/* **************************************************************** *\
@@ -2093,9 +2140,6 @@
*/
fwGet: function(varName,defValue) {
var retval = x6.p(this.fwvars,varName,defValue);
- //if(typeof(console)!='undefined') {
- // console.log("vgfGet",varName,retval,defValue);
- //}
return retval;
},
/******/
@@ -2316,22 +2360,29 @@
*
******
*/
- makeMap: false,
+ makeMap: true,
map: [ ],
mapStack: [ ],
mapClear: function() {
this.map = [ { name: 'root', kids: [ ] } ];
this.mapStack = [ this.map[0] ];
},
- mapWrite: function(map,indent,level) {
- if(map ==null) map = this.map;
- if(level ==null) level = 0;
- if(indent==null) indent='';
+ mapWrite: function(map) {
+ iAmRoot = false;
+ if(map ==null) {
+ var conEnabled = x6.console.enableAll();
+ var iAmRoot = true;
+ map = this.map;
+ }
var maplen = map.length;
for(var x=0; x<maplen; x++) {
- this.mapWrite(map[x].kids,indent+' ',level+1)
+ x6.console.group(map[x].name);
+ this.mapWrite(map[x].kids);
+ x6.console.groupEnd(map[x].name);
}
-
+ if(iAmRoot) {
+ x6.console.disableAll(conEnabled);
+ }
},
retvals: { },
@@ -2762,11 +2813,12 @@
// If async, we have to do it a little differently
// KFD 11/24, did nothing yet for async
+ var json = this;
if(async) {
- http.onreadystatechange = function() {
+ this.http.onreadystatechange = function() {
if(this.readyState!=4) return;
- x6.json.processPre(this,key,false);
- x6.json.process();
+ json.processPre(false);
+ json.process();
}
}
@@ -2789,7 +2841,7 @@
eval('this.jdata = '+this.http.responseText);
}
catch(e) {
- $a.dialogs.alert("Could not process server response!");
+ x6dialogs.alert("Could not process server response!");
if(typeof(x4)!='undefined') {
x4.debug(this.http.responseText);
}
@@ -2808,11 +2860,11 @@
// If there were server errors, report those
if(this.jdata.error.length>0 && this.reportErrors) {
this.hadErrors = true;
- $a.dialogs.alert(this.jdata.error.join("\n\n"));
+ x6dialogs.alert(this.jdata.error.join("\n\n"));
return false;
}
if(this.jdata.notice.length>0 && this.reportErrors) {
- $a.dialogs.alert(this.jdata.notice.join("\n\n"));
+ x6dialogs.alert(this.jdata.notice.join("\n\n"));
}
if(autoProcess) {
@@ -2966,6 +3018,30 @@
x6.console.log(e);
x6.console.log(inp);
+ // KFD 1/15/09. Key post-processing. Reformat a date
+ var type = $(inp).attr('xtypeid');
+ if(type=='date') {
+ // this will work until the year 2020
+ var value = $(inp).attr('value').trim();
+ if(value.length==6) {
+ if(value.indexOf('/')==-1 && value.indexOf('-')==-1) {
+ var month=value.substr(0,2);
+ var day =value.substr(2,2);
+ var year =value.substr(4,2);
+ yearint = parseInt(year);
+ if(yearint < 30) {
+ year = '20'+year;
+ }
+ else {
+ year = '19'+year;
+ }
+ inp.value=month+'/'+day+'/'+year;
+ }
+ }
+ }
+
+
+
x6inputs.setClass(inp);
x6.console.groupEnd("Input keyUp");
},
@@ -2985,7 +3061,7 @@
var isTab =keyLabel=='Tab' || keyLabel=='ShiftTab';
var isEnter =keyLabel=='Enter' || keyLabel=='ShiftEnter';
var isMeta =x6.keyIsMeta(e);
- var isNav =isEnter || isTab;
+ var isNav =isTab || (x6.options.get('navOnEnter',false) && isEnter);
x6.console.log("label: " ,keyLabel);
x6.console.log('isTab: ' ,isTab );
x6.console.log('isEnter: ',isEnter );
@@ -3122,6 +3198,9 @@
x6.console.groupEnd();
return true;
}
+ // <---- EARLY RETURN. If we did type validation
+ // we are finished. The rest of
+ // this is only for TAB.
// If this input has an open x6select (SELECT replacement)
// then ask it for the value.
@@ -3738,8 +3817,14 @@
.mousedown(
function(e) {
this.input.value = this.parentNode.firstChild.innerHTML;
+ x6inputs.afterBlurner(this.input);
x6inputs.x6select.hide();
- setTimeout(function() {$(this.input).focus();},100);
+ setTimeout(
+ function() {
+ $(this.input).focus();
+ }
+ ,100
+ );
e.stopPropagation();
return false;
}
@@ -4218,6 +4303,8 @@
self['receiveEvent_reqUndoRow_'+table] = function() {
x6.console.group("tableController reqUndoRow");
var skey = x6bb.fwGet('skey_'+table);
+
+ /*
if(skey>=0) {
x6.console.log("Skey is >= 0, continuing ",skey);
$(this).find(":input:not([disabled])[zActive]").each(
@@ -4227,8 +4314,10 @@
x6inputs.setClass(this);
}
);
- x6events.fireEvent('uiUndoRow_'+this.zTable,skey);
+ //x6events.fireEvent('uiUndoRow_'+this.zTable,skey);
}
+ */
+ x6events.fireEvent('uiUndoRow_'+this.zTable,skey);
x6.console.log("tableController reqUndoRow Finished");
x6.console.groupEnd();
return true;
@@ -4342,58 +4431,60 @@
* Two requests, one to turn on editing-mode buttons,
* another to turn them off. Third to turn on just new/ins
*/
- x6events.subscribeToEvent('buttonsOn_'+table,id);
- self['receiveEvent_buttonsOn_'+table] = function(forceAll) {
- /*
- * If another table has its buttons on, they
- * must be turned off.
- */
- var buttonsTable = x6bb.fwGet('buttonsTable','');
- if(buttonsTable!='' && buttonsTable != this.zTable) {
- x6events.fireEvent('buttonsOff_'+buttonsTable);
+ x6events.subscribeToEvent('buttonsNew_'+table,id);
+ self['receiveEvent_buttonsNew_'+table] = function(turnOn) {
+ if(turnOn==null) turnOn = false;
+
+ // Turn on the default property
+ if(typeof(this.buttonsNew)=='undefined') this.buttonsNew=false;
+
+ // Branch 1: turn off. Notice two return statements
+ if(!turnOn) {
+ if(!this.buttonsNew) return;
+ x6events.fireEvent('disable_new_' +this.zTable);
+ x6events.fireEvent('disable_ins_' +this.zTable);
+ this.buttonsNew = false;
+ return;
}
- // Establish table permissions
+ // Branch 2: turn on
+ if(this.buttonsNew) return;
var permins = x6.p(this,'xPermIns','Y')=='N' ? false : true;
- var permupd = x6.p(this,'xPermUpd','Y')=='N' ? false : true;
- var permdel = x6.p(this,'xPermDel','Y')=='N' ? false : true;
- var permsave= permins || permupd;
-
- // Now only turn buttons on if we have an skey
- var skey = x6bb.fwGet('skey_'+this.zTable);
- x6.console.log("current skey is ",skey);
if(permins) {
x6events.fireEvent('enable_new_' +this.zTable);
x6events.fireEvent('enable_ins_' +this.zTable);
}
- if(skey >= 0) {
- if(permsave) {
- x6events.fireEvent('enable_save_' +this.zTable);
- x6events.fireEvent('enable_cancel_' +this.zTable);
- }
- if(permdel) {
- x6events.fireEvent('enable_delete_' +this.zTable);
- }
- }
- x6bb.fwSet('buttonsTable',this.zTable);
+ this.buttonsNew = true;
}
- x6events.subscribeToEvent('buttonsOff_'+table,id);
- self['receiveEvent_buttonsOff_'+table] = function(forceAll) {
- if(forceAll) {
- x6events.fireEvent('disable_new_' +this.zTable);
- x6events.fireEvent('disable_ins_' +this.zTable);
+
+ x6events.subscribeToEvent('buttonsEdit_'+table,id);
+ self['receiveEvent_buttonsEdit_'+table] = function(turnOn) {
+ if(turnOn==null) turnOn = false;
+
+ // Branch 1: turn off. Notice early returns
+ if(!turnOn) {
+ if(!this.buttonsEdit) return;
+ x6events.fireEvent('disable_save_' +this.zTable);
+ x6events.fireEvent('disable_cancel_' +this.zTable);
+ x6events.fireEvent('disable_delete_' +this.zTable);
+ this.buttonsNew = false;
+ return;
}
- x6events.fireEvent('disable_save_' +this.zTable);
- x6events.fireEvent('disable_cancel_' +this.zTable);
- x6events.fireEvent('disable_delete_' +this.zTable);
- }
- x6events.subscribeToEvent('buttonsNew_'+table,id);
- self['receiveEvent_buttonsNew_'+table] = function() {
+
+ // Branch 2: turn on
+ if(this.buttonsEdit) return;
var permins = x6.p(this,'xPermIns','Y')=='N' ? false : true;
- if(permins) {
- x6events.fireEvent('enable_new_' +this.zTable);
- x6events.fireEvent('enable_ins_' +this.zTable);
+ var permupd = x6.p(this,'xPermUpd','Y')=='N' ? false : true;
+ var permdel = x6.p(this,'xPermDel','Y')=='N' ? false : true;
+ var permsave= permins || permupd;
+ if(permupd) {
+ x6events.fireEvent('enable_save_' +this.zTable);
+ x6events.fireEvent('enable_cancel_' +this.zTable);
}
+ if(permdel) {
+ x6events.fireEvent('enable_delete_' +this.zTable);
+ }
+ this.buttonsEdit = true;
}
}
@@ -4745,7 +4836,7 @@
else {
if(x6bb.fwGet('objectFocus','')!=id) {
this.keyboardOn();
- x6events.fireEvent('buttonsOn_'+this.zTable);
+ x6events.fireEvent('buttonsNew_'+this.zTable,true);
if(this.x6profile == 'x6tabDiv') {
x6events.fireEvent('key_DownArrow','DownArrow');
@@ -4915,7 +5006,7 @@
// Send a message and get lost
x6bb.fwSet('skey_'+this.zTable,0);
- x6events.fireEvent('buttonsOn_'+this.zTable);
+ x6events.fireEvent('buttonsOnEdit_'+this.zTable);
x6tabDiv.removeHighlight(this.zTable);
x6.console.log('New row created, ready to edit');
x6.console.timeEnd("tabDiv uiNewRow");
@@ -5016,7 +5107,7 @@
x6tabDiv.removeHighlight(this.zTable);
x6bb.fwSet('skey_'+this.zTable,skey);
- x6events.fireEvent('buttonsOn_'+this.zTable);
+ x6events.fireEvent('buttonsEdit_'+this.zTable,true);
//this.keyboardOff();
x6.console.log('uiEditRow Completed, returning true');
x6.console.groupEnd();
@@ -5135,16 +5226,35 @@
if(skey!=0) {
x6.console.log("Skey is not zero, resetting values");
//$(this).find('#row_'+skey+' :input').each(
- $(this.rowId(skey)+' :input').each(
+ var change = 0;
+ $(this.rowId(skey)+' :input:not([disabled])').each(
function() {
- this.value = this.zOriginalValue;
- x6inputs.setClass(this);
+ if(this.value.trim()!=this.zOriginalValue.trim()) {
+ change++;
+ console.log(this.value);
+ console.log(this.zOriginalValue);
+ this.value = this.zOriginalValue.trim();
+ this.zOriginalValue = this.value;
+ console.log(this.value);
+ console.log(this.zOriginalValue);
+ x6inputs.setClass(this);
+ console.log(this.value);
+ console.log(this.zOriginalValue);
+ }
}
);
+
+ // When we do an undo, the user might have hit
+ // ESC to do it. If anything was changed, we
+ // do not want the ESC to exit the screen.
+ //if(change>0) {
+ // x6bb.fwSet('exitApproved',false);
+ //}
}
else {
x6.console.log("Skey is zero, removing row");
this.removeInputs();
+ x6bb.fwSet('exitApproved',false);
var iBefore = x6bb.fwGet('skeyBefore_'+this.zTable,-1);
var iAfter = x6bb.fwGet('skeyAfter_' +this.zTable,-1);
x6.console.log(iBefore,iAfter);
@@ -5179,6 +5289,28 @@
x6.console.group("tabDiv uiRowSaved: "+this.zTable);
// Replace the input values with server returned values
skey = x6bb.fwGet('skey_'+this.zTable);
+
+ // KFD 1/15/09. Major change. If profile is 'x6tabDiv'
+ // then simply replace input values and
+ // we are done.
+ if($(this).attr('x6profile')=='x6tabDiv') {
+ x6.console.log("Profile x6tabDiv, updating inputs and returning");
+ var grid = this;
+ $(this.rowId(skey)+" :input").each(
+ function() {
+ var col = $(this).attr('xColumnId');
+ var typeid = grid.zColsById[col].type_id;
+ x6.console.log("setting: ",col,row[col]);
+ this.value = x6dd.display(typeid,row[col],'');
+ this.zOriginalValue = this.value;
+ x6inputs.setClass(this);
+ }
+ );
+ x6.console.groupEnd();
+ return;
+ }
+ // <-------- EARLY RETURN for profile x6tabDiv
+
//if( $(this).find("#row_"+skey+" :input").length > 0) {
if( $(this.rowId(skey)+' :input').length > 0) {
x6.console.log($(this).find("#row_"+skey+" :input"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dor...@us...> - 2009-01-16 01:25:38
|
Revision: 1099
http://andro.svn.sourceforge.net/andro/?rev=1099&view=rev
Author: dorgan1983
Date: 2009-01-16 01:25:33 +0000 (Fri, 16 Jan 2009)
Log Message:
-----------
For some reason chaining doesn't work
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-15 20:26:29 UTC (rev 1098)
+++ trunk/andro/clib/x6.js 2009-01-16 01:25:33 UTC (rev 1099)
@@ -4524,8 +4524,11 @@
function() {
x6inputs.disable(this);
}
- )
- .find("textarea").each(
+ );
+
+ // DO 1-15-2009 For some reason chaining
+ // this to the above doesnt work
+ $(self).find("textarea").each(
function() {
var el = '#' + $(this).attr('id');
var wysiwyg = el + '_WYSIWYG';
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-16 16:32:17
|
Revision: 1101
http://andro.svn.sourceforge.net/andro/?rev=1101&view=rev
Author: kendowns
Date: 2009-01-16 16:32:07 +0000 (Fri, 16 Jan 2009)
Log Message:
-----------
Major refactoring of grid (tabDiv) to eliminate repeat calls to same routine, eliminate unnecessary calls, move some actions to ideal locations, smooth out logging, and make IE 6 compatible (mostly). tabDiv is now considered finished except for bugs.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-16 01:44:29 UTC (rev 1100)
+++ trunk/andro/clib/x6.js 2009-01-16 16:32:07 UTC (rev 1101)
@@ -27,7 +27,75 @@
window.androIsIE = false;
}
+/* **************************************************************** *\
+ jQuery Plugins
+
+\* **************************************************************** */
+
+// Plugin to get or set properties. Required because:
+//
+// -> IE does not expose things like input.value as a property,
+// only as an attribute
+// -> the jQuery attr() function does not allow returning a
+// default value, which would clutter our code with conditionals
+//
+jQuery.fn.prop = function(propX,defValue) {
+ // If they gave us an object, they want to set the
+ // properties. We will do a standard jQuery plugin
+ // that returns this.each() and sets to all.
+ if(typeof(propX)=='object') {
+ return this.each(
+ function() {
+ for(var name in propX) {
+ // If they are setting an existing attribute,
+ // save it that way, otherwise save it as
+ // a JS property.
+ var value = propX[name];
+ if(typeof(this.attributes[name])!='undefined') {
+ this.setAttribute(name,value);
+ }
+ else {
+ this[name] = value;
+ }
+ }
+ }
+ );
+ }
+
+ // Otherwise, they must be requesting a property value, so
+ // we will return a value only for the first matched value
+ if(this.length==0) return null;
+ var obj = this[0];
+ if(defValue==null) defValue='';
+
+ // First try, maybe it is a direct property
+ if(typeof(obj[propX])!='undefined') {
+ return obj[propX];
+ }
+
+ // second try, an attribute
+ if(typeof(obj.attributes[propX])!='undefined') {
+ return obj.getAttribute(propX);
+ }
+
+ // Last chance, return the default they requested
+ return defValue;
+};
+
+// Plugin to cancel an event. Can I really have missed
+// the jQuery mechanism for doing this?
+//
+jQuery.fn.stopPropagation = function() {
+ return this.each(
+ function() {
+ if(this.stopPropagation) this.stopPropagation();
+ if(this.cancelBubble) this.cancelBubble = true;
+ }
+ );
+};
+
+
/* **************************************************************** *\
Cookie functions.
@@ -63,6 +131,8 @@
/* **************************************************************** *\
+ NOTE: This is not actually referenced yet. If we get
+ IE working w/o it, remove. KFD 1/16/09
Cross Browser selectionStart/selectionEnd
Version 0.2
@@ -515,8 +585,9 @@
if(window.androIsIE) {
$(document).keydown(function(e) {
//e = e ? e : window.event;
+ var keyLabel = x6.keyLabel(e);
x6.console.group("Document Keydown");
- if(x6bb.fwGet('noKeyPress',false)==true) {
+ if(x6bb.fwGet('noKeyPress',false)==keyLabel) {
x6.console.log("noKeyPress was set, ignoring");
x6bb.fwSet('noKeyPress',false);
}
@@ -531,8 +602,10 @@
else {
$(document).keypress(function(e) {
//e = e ? e : window.event;
- x6.console.group("Document Keydown");
- if(x6bb.fwGet('noKeyPress',false)==true) {
+ x6.console.group("Document Keypress");
+ var keyLabel = x6.keyLabel(e);
+ /*
+ if(x6bb.fwGet('noKeyPress',false)==keyLabel) {
x6.console.log("noKeyPress was set, ignoring");
x6bb.fwSet('noKeyPress',false);
}
@@ -540,6 +613,8 @@
// no log entry, key dispatcher does that
var retval= x6.keyDispatcher(e);
}
+ */
+ var retval= x6.keyDispatcher(e);
x6.console.groupEnd();
return retval;
});
@@ -582,7 +657,7 @@
z++;
}
if(x6.p(x[z],'id','').trim() !='') {
- x[z].focus();
+ setTimeout(function() {x[z].focus();},100);
}
}
}
@@ -619,7 +694,8 @@
'CtrlL', 'CtrlO', 'CtrlW', 'CtrlP',
'CtrlQ', 'CtrlR', 'CtrlU', 'CtrlK',
'CtrlY',
- 'DownArrow','UpArrow'
+ 'DownArrow','UpArrow',
+ 'ShiftDownArrow','ShiftUpArrow'
];
// Set a flag now. If user hit ESC, we are trying
@@ -666,7 +742,7 @@
if(noPropagate.indexOf(retval)>=0) {
x6.console.log("In no propagate list, stopping");
x6.console.groupEnd();
- e.stopPropagation();
+ $(e).stopPropagation();
return false;
}
else {
@@ -790,7 +866,7 @@
123: 'F12'
},
keyLabel: function(e) {
- x6.console.group("Key Label processing, event follows");
+ x6.console.group("Key Label processing");
x6.console.log(e);
// if e.originalEvent is defined, this is a jQuery event.
// jQuery events have charCode for non-meta keys, and they
@@ -862,6 +938,8 @@
var numbers = [ '0','1','2','3','4','5','6','7','8','9' ];
var retval = numbers[x - 96];
x6.console.log("number pad number, returning: ",retval);
+ x6.console.groupEnd();
+ return retval;
}
else if(x >= 48 && x <= 57) {
if(e.shiftKey) {
@@ -874,6 +952,7 @@
if(e.ctrlKey) retval = 'Ctrl' + retval;
if(e.altKey) retval = 'Alt' + retval;
x6.console.log("Found number, returning: ",retval);
+ x6.console.groupEnd();
return retval;
}
else {
@@ -1300,14 +1379,14 @@
}
else {
if(typeof(x6)=='undefined') {
- if(this.value!='') {
- x6.json.addParm(id,this.value);
+ if($(this).prop('value')!='') {
+ x6.json.addParm(id,$(this).prop('value'));
}
}
else {
var zOrig = x6.p(this,'zOriginalValue','').trim();
- if(this.value.trim()!=zOrig) {
- x6.json.addParm(id,this.value);
+ if($(this).prop('value').trim()!=zOrig) {
+ x6.json.addParm(id,$(this).prop('value'));
}
}
}
@@ -2234,6 +2313,7 @@
******
*/
subscribers: { },
+ subsById: { },
eventsDisabled: false,
disableEvents: function() {
@@ -2272,42 +2352,48 @@
* SOURCE
*/
subscribeToEvent: function(eventName,id) {
- x6.console.group("subscribeToEvent "+eventName);
- x6.console.log("event name: ",eventName)
- x6.console.log("id subscriber: ",id);
if(id=='undefined') {
x6.console.error('x6events.subscribeToEvent. Second parameter '
+' undefined. First parameter: '+eventName
);
- return;
}
- if(id==null) {
+ else if(id==null) {
x6.console.error('x6events.subscribeToEvent. Second parameter '
+' null. First parameter: '+eventName
);
- return;
}
-
- // First determine if we have any listeners for this
- // event at all. If not, make up the empty object
- if( x6.p(this.subscribers,eventName,null)==null) {
- this.subscribers[eventName] = [ ];
+ else {
+ // First determine if we have any listeners for this
+ // event at all. If not, make up the empty object
+ if( typeof(this.subscribers[eventName])=='undefined') {
+ this.subscribers[eventName] = [ ];
+ }
+ if(this.subscribers[eventName].indexOf(id)==-1) {
+ this.subscribers[eventName].push(id);
+ }
+ if( typeof(this.subsById[id])=='undefined') {
+ this.subsById[id] = [ ];
+ }
+ if(this.subsById[id].indexOf(eventName)==-1) {
+ this.subsById[id].push(eventName);
+ }
}
- if(this.subscribers[eventName].indexOf(id)==-1) {
- this.subscribers[eventName].push(id);
- }
- x6.console.groupEnd();
},
/******/
unsubscribeToEvent: function(eventName,id) {
- var subs = x6.p(this.subscribers,eventName);
- if( subs!=null) {
+ if(typeof(this.subscribers[eventName])!='undefined') {
var i = this.subscribers[eventName].indexOf(id);
if(i >= 0) {
this.subscribers[eventName].splice(i,1);
}
}
+ if(typeof(this.subsById[id])!='undefined') {
+ var i = this.subsById[id].indexOf(eventName);
+ if(i >= 0) {
+ this.subsById[id].splice(i,1);
+ }
+ }
},
/****m* events/getSubscribers
@@ -2621,8 +2707,8 @@
}
}
else {
- if(this.value!='') {
- x6.json.addParm(id,this.value);
+ if($(this).prop('value')!='') {
+ x6.json.addParm(id,$(this).prop('value'));
}
}
});
@@ -3035,7 +3121,7 @@
else {
year = '19'+year;
}
- inp.value=month+'/'+day+'/'+year;
+ $(inp).prop({value:month+'/'+day+'/'+year});
}
}
}
@@ -3058,6 +3144,14 @@
x6.console.log(inp);
x6.console.log(e);
var keyLabel=x6.keyLabel(e);
+
+ // KFD 1/15/09. Inputs never deal with Ctrl or Alt
+ if(keyLabel.slice(0,4)=='Ctrl' || keyLabel.slice(0,3)=='Alt') {
+ x6.console.log('Ctrl or alt, input keydown returning true');
+ x6.console.groupEnd();
+ return true;
+ }
+
var isTab =keyLabel=='Tab' || keyLabel=='ShiftTab';
var isEnter =keyLabel=='Enter' || keyLabel=='ShiftEnter';
var isMeta =x6.keyIsMeta(e);
@@ -3074,7 +3168,7 @@
if(handUpList.indexOf(keyLabel)>=0) {
// If we are passing it up or not, it should not be
// handled by the doc level, so we suppress it.
- x6bb.fwSet('noKeyPress',true);
+ x6bb.fwSet('noKeyPress',keyLabel);
x6.console.log("This key may be passed up to doc handler.");
// An explicit flag can prevent handing events up
if(x6.p(inp,'xNoPassup','N')=='N') {
@@ -3118,7 +3212,7 @@
x6.console.log(inp);
var ss = inp.selectionStart;
var se = inp.selectionEnd;
- var ln = inp.value.toString().trim().length;
+ var ln = $(inp).val().toString().trim().length;
x6.console.log(ss,se,ln);
if(ss == se && se == ln) this.lastInput(inp);
}
@@ -3171,11 +3265,11 @@
if(x6.p(inp,'x6select','N')=='Y' && x6.p(inp,'xValues',null)==null) {
// Generate the value to send back
x6.console.group("An x6select, fetching from Server");
- var val = inp.value;
+ var val = $(inp).val();
var val = val.slice(0,inp.selectionStart)
+keyLabel
+val.slice(inp.selectionEnd);
- x6.console.log("current value: ",inp.value)
+ x6.console.log("current value: ",$(inp).val())
x6.console.log("sel start: ",inp.selectionStart)
x6.console.log("sel end: ",inp.selectionEnd)
x6.console.log("computed value:",val);
@@ -3415,7 +3509,12 @@
},
setClass: function(inp) {
- if(x6.p(inp,'xLookup')=='Y') return;
+ x6.console.group("setClass for input "+inp.id);
+ if(x6.p(inp,'xLookup')=='Y') {
+ x6.console.groupEnd();
+ return;
+ }
+ //<-------- EARLY RETURN
// If permupd for this table is "N", all controls
// become read only
@@ -3431,14 +3530,13 @@
if(doRow!=0) {
inp.parentNode.parentNode.className = '';
}
+ x6.console.groupEnd();
return;
}
+ //<------------ EARLY RETURN
- ux = x6.uniqueId();
- x6.console.group("setClass for an input "+ux);
- x6.console.log(inp);
if(x6.p(inp,'zOriginalValue',null)==null) inp.zOriginalValue = '';
- if(inp.value.trim()==inp.zOriginalValue.trim()) {
+ if($(inp).val().trim()==inp.zOriginalValue.trim()) {
inp.zChanged = 0;
}
else {
@@ -3495,7 +3593,7 @@
inp.disabled = true;
inp.zNew = 0;
inp.zSelected = 0;
- inp.value = '';
+ $(inp).prop({value:''});
inp.zOriginalValue = '';
x6inputs.setClass(inp);
},
@@ -3580,6 +3678,8 @@
addButton: function(input) {
if(x6.p(input,'x6select','N')=='Y') {
+ if(x6.p(input,'zHasButton',false)==true) return;
+ input.zHasButton = true;
var str= '<span '
+ 'class="button" '
+ 'xInputId="'+input.id+'" '
@@ -3607,7 +3707,7 @@
if(this.div) {
var row = $('.x6select tr.hilight');
if(row.length > 0) {
- inp.value = row[0].firstChild.innerHTML;
+ $(inp).prop({value:row[0].firstChild.innerHTML});
}
}
},
@@ -3816,7 +3916,9 @@
)
.mousedown(
function(e) {
- this.input.value = this.parentNode.firstChild.innerHTML;
+ $(this.input).prop(
+ {value:this.parentNode.firstChild.innerHTML}
+ );
x6inputs.afterBlurner(this.input);
x6inputs.x6select.hide();
setTimeout(
@@ -4107,7 +4209,7 @@
*/
x6plugins.tableController = function(self,id,table) {
// Initialize new properties
- x6bb.fwSet('skey_'+table,-1);
+ self.zSkey = -1;
self.zTable = table;
self.zSortCol = false;
self.zSortAsc = false;
@@ -4125,23 +4227,35 @@
x6bb.fwSet('permsel_'+table,x6.p(self,'xPermSel'));
}
+ /* -------------------------------------------------------------- */
+
/*
- * Table controller accepts the request to
- * save current changes. First checks if this
- * makes sense.
+ * Table controller accepts a request to edit a
+ * row. It is smart enough that if we are already
+ * editing that row it does nothing. Otherwise
+ * it tries to save any existing row before
+ * deciding whether to move on.
*
*/
- x6events.subscribeToEvent('reqSaveRow_'+table,id);
- self['receiveEvent_reqSaveRow_'+table] = function(dupe) {
- x6.console.group("tableController reqSaveRow "+this.zTable);
-
- var result = this.saveOk();
- x6bb.fwSet('lastSave_'+this.zTable,result);
- x6.console.log('tableController reqSaveRow finished');
+ x6events.subscribeToEvent('reqEditRow_'+table,id);
+ self['receiveEvent_reqEditRow_'+table] = function(skey) {
+ x6.console.group("tableController reqEditRow "+this.zTable+", "+skey);
+ var skeynow = this.zSkey;
+ if(skeynow == skey) {
+ x6.console.log("Request to edit same row, no action");
+ }
+ else {
+ var result = this.saveOk();
+ x6bb.fwSet('lastSave_'+this.zTable,result);
+ if(result!='fail') {
+ x6events.fireEvent('uiEditRow_'+this.zTable,skey);
+ this.zSkey = skey;
+ }
+ }
x6.console.groupEnd();
+ return true;
}
-
-
+
/*
* Table controller accepts the request to
* begin editing a new row. It must first
@@ -4155,39 +4269,35 @@
self['receiveEvent_reqNewRow_'+table] = function(tabDivBefore) {
x6.console.group("tableController reqNewRow "+this.zTable);
+ var skeynow= this.zSkey;
var result = this.saveOk();
- x6bb.fwSet('lastSave_'+this.zTable,result);
- if(result!='fail') {
- x6events.fireEvent('uiNewRow_'+this.zTable,tabDivBefore);
+ if(result=='noaction' && skeynow==0) {
+ // no action if trying to do new while on
+ // a new that requires no action (cuz its blank)
}
+ else {
+ x6bb.fwSet('lastSave_'+this.zTable,result);
+ if(result!='fail') {
+ x6events.fireEvent('uiNewRow_'+this.zTable,tabDivBefore);
+ this.zSkey = 0;
+ }
+ }
x6.console.groupEnd();
}
/*
- * Table controller accepts a request to edit a
- * row. It is smart enough that if we are already
- * editing that row it does nothing. Otherwise
- * it tries to save any existing row before
- * deciding whether to move on.
+ * Table controller accepts the request to
+ * save current changes. First checks if this
+ * makes sense.
*
*/
- x6events.subscribeToEvent('reqEditRow_'+table,id);
- self['receiveEvent_reqEditRow_'+table] = function(skey) {
- x6.console.group("tableController reqEditRow "+this.zTable);
- var skeynow = x6bb.fwGet('skey_'+this.zTable);
- if(skeynow == skey) {
- x6.console.log("Request to edit same row, no action");
- }
- else {
- var result = this.saveOk();
- x6bb.fwSet('lastSave_'+this.zTable,result);
- if(result!='fail') {
- x6events.fireEvent('uiEditRow_'+this.zTable,skey);
- }
- }
- x6.console.log("tableController reqEditRow finished");
+ x6events.subscribeToEvent('reqSaveRow_'+table,id);
+ self['receiveEvent_reqSaveRow_'+table] = function(dupe) {
+ x6.console.group("tableController reqSaveRow "+this.zTable);
+
+ var result = this.saveOk();
+ x6bb.fwSet('lastSave_'+this.zTable,result);
x6.console.groupEnd();
- return true;
}
/*
@@ -4202,17 +4312,17 @@
var inpAll = { };
var inpChg = { };
var cntChg = 0;
- var jq = ':input[xtableid='+this.zTable+'][zActive]';
+ var jq = ':input[xtableid='+this.zTable+'][zActive]:not([disabled])';
x6.console.log("Query string",jq);
var rowOld = { };
$(jq).each(
function() {
var col = x6.p(this,'xcolumnid');
- inpAll[col] = this.value;
+ inpAll[col] = $(this).prop('value');
rowOld[col] = x6.p(this,'zOriginalValue','').trim();
var oval = x6.p(this,'zOriginalValue','').trim();
- if(this.value.trim()!= oval) {
- inpChg[col] = this.value.trim();
+ if($(this).prop('value').trim()!= oval) {
+ inpChg[col] = $(this).prop('value').trim();
cntChg++;
}
}
@@ -4225,7 +4335,7 @@
// Only attempt a save if something changed
if(cntChg == 0) {
var retval = 'noaction';
- var skeynow=x6bb.fwGet('skey_'+this.zTable)
+ var skeynow= this.zSkey;
if(skeynow==0) {
x6.console.log(" ---- was editing new row, exit denied ---- ");
x6bb.fwSet('exitApproved',false);
@@ -4236,10 +4346,10 @@
x6bb.fwSet('exitApproved',false);
x6.console.log("attempting database save");
- x6.console.log("Sending x4v_skey ",this.zSkey);
+ x6.console.log("Sending x6v_skey ",this.zSkey);
x6.json.init('x6page',this.zTable);
x6.json.addParm('x6action','save');
- x6.json.addParm('x6v_skey',x6bb.fwGet('skey_'+this.zTable));
+ x6.json.addParm('x6v_skey',this.zSkey);
x6.json.inputs(jq);
// Look for an "skey after" to send back
var queuepos = x6bb.fwGet('queuepos_'+this.zTable,false);
@@ -4253,6 +4363,7 @@
if(x6.json.execute()) {
var retval = 'success';
x6.json.process();
+ this.zSkey = x6.data.row.skey;
}
else {
var retval = 'fail';
@@ -4279,52 +4390,20 @@
);
- x6.console.log(retval);
+ x6.console.log("saveOk result: "+retval);
x6events.fireEvent('uiRowSaved_'+table,x6.data.row);
if(this.zCache) {
this.zRows[x6.data.row.skey] = x6.data.row;
}
}
- x6.console.log("tableController saveOK RETURNING: ",retval);
x6.console.groupEnd();
return retval;
};
+ /* -------------------------------------------------------------- */
/*
- * The table controller accepts requests to undo
- * changes to a row. It actually rolls back all
- * inputs and sets their classes, and then
- * fires of a uiUndoRow event so various other
- * elements can do their own thing.
- */
- x6events.subscribeToEvent('reqUndoRow_'+table,id);
- self['receiveEvent_reqUndoRow_'+table] = function() {
- x6.console.group("tableController reqUndoRow");
- var skey = x6bb.fwGet('skey_'+table);
-
- /*
- if(skey>=0) {
- x6.console.log("Skey is >= 0, continuing ",skey);
- $(this).find(":input:not([disabled])[zActive]").each(
- function() {
- this.value = this.zOriginalValue;
- this.zError = 0;
- x6inputs.setClass(this);
- }
- );
- //x6events.fireEvent('uiUndoRow_'+this.zTable,skey);
- }
- */
- x6events.fireEvent('uiUndoRow_'+this.zTable,skey);
- x6.console.log("tableController reqUndoRow Finished");
- x6.console.groupEnd();
- return true;
- }
-
-
- /*
* The table controller accepts delete request
* and asks the database to do the delete. If
* this is successful, it tells any UI subscribers
@@ -4333,8 +4412,8 @@
x6events.subscribeToEvent('reqDelRow_' +table,id);
self['receiveEvent_reqDelRow_'+table] = function() {
x6.console.group("tableController reqDelRow ",this.zTable);
- var skey = x6bb.fwGet('skey_'+this.zTable);
- if(this.zSkey<1) {
+ var skey = this.zSkey;
+ if(skey<1) {
x6.console.log("nothing being edited, quietly ignoring");
}
else {
@@ -4353,6 +4432,22 @@
x6.console.groupEnd();
return true;
}
+
+ /*
+ * The table controller accepts requests to undo
+ * changes to a row. It actually rolls back all
+ * inputs and sets their classes, and then
+ * fires of a uiUndoRow event so various other
+ * elements can do their own thing.
+ */
+ x6events.subscribeToEvent('reqUndoRow_'+table,id);
+ self['receiveEvent_reqUndoRow_'+table] = function() {
+ x6.console.group("tableController reqUndoRow");
+ x6events.fireEvent('uiUndoRow_'+this.zTable,this.zSkey);
+ x6.console.groupEnd();
+ return true;
+ }
+
// Sort requests are sorted out here.
x6events.subscribeToEvent('reqSort_'+table,id);
@@ -4578,7 +4673,7 @@
}
/*
- * A uiRowSaved says there are new values. This
+ * detailDisplay uiRowSaved says there are new values. This
* will be caught and interpreted as a uiEditRow
*/
x6events.subscribeToEvent('uiRowSaved_'+table,id);
@@ -4609,7 +4704,7 @@
/*
- * A uiDelRow clears all inputs
+ * A detail accepts uiDelRow and clears inputs
*/
x6events.subscribeToEvent('uiDelRow_'+table,id);
self['receiveEvent_uiDelRow_'+table] = function(skey) {
@@ -4641,8 +4736,8 @@
// For new rows, set defaults, otherwise blank
// out.
$(this).find(':input').each(function() {
- this.value=x6.p(this,'xdefault','');
- this.zOriginalValue = this.value;
+ $(this).prop({value: $(this).prop('xdefault')});
+ this.zOriginalValue = $(this).prop('value');
this.zChanged = 0;
this.zActive = 1;
});
@@ -4818,9 +4913,9 @@
******
*/
x6plugins.x6tabDiv = function(self,id,table) {
+ self.zSkey = -1;
self.zTable = table;
self.x6profile = x6.p(self,'x6profile','none');
- self.kbOnEdit = ['x6tabDiv','twosides'].indexOf(self.x6profile)>=0;
/*
* Many plugins can receive the objectFocus event
@@ -4828,8 +4923,7 @@
*/
x6events.subscribeToEvent('objectFocus',id);
self.receiveEvent_objectFocus = function(id) {
- x6.console.group("Object Focus: ",id,this.id);
- // If it is NOT us, turn everything off
+ x6.console.group("Object Focus for: "+id+", we are "+this.id);
if(id!=this.id) {
this.keyboardOff();
}
@@ -4851,6 +4945,7 @@
x6.console.groupEnd();
}
+ /* --------------------------------------------------------------- */
/*
* These two will tell us down below if the grid
@@ -4861,25 +4956,9 @@
var uiEditRow = x6.p(self,'uiEditRow','');
/*
- * A grid may be set to receive a cacheRows event.
- * If so, it will replace its own data with the
- * data that has been provided.
+ * Two functions to make an ID out of an skey or
+ * pull an skey out of an id
*/
- /* SUSPICIOUS, probably do not need this
- if(x6.p(self,'xCacheRows','')=='Y') {
- x6events.subscribeToEvent('cacheRows_'+table,id);
-
- self['receiveEvent_cacheRows_'+table] = function(rows) {
- // Clear current data
- $(this).find('.tbody').html();
- // Add new data
- //for(var x in rows) {
- // this.addRow(rows[x]);
- //}
- }
- }
- */
-
self.rowId = function(skey,noPound) {
return (noPound==null ? '#' : '')+this.zTable+'_'+skey;
}
@@ -4897,47 +4976,23 @@
* all prerequisites have been met and the grid
* should proceed forthwith.
*/
- x6events.subscribeToEvent('uiNewRow_'+table,id);
- if(uiNewRow!='Y') {
- // If the grid itself does not display the row, then it
- // stops responding to keyboard events while somebody
- // else is displaying the new row.
- self['receiveEvent_uiNewRow_'+table] = function() {
- this.keyboardOff();
- }
- }
- else {
+ if(uiNewRow=='Y') {
+ x6events.subscribeToEvent('uiNewRow_'+table,id);
self['receiveEvent_uiNewRow_'+table] = function(tabDivBefore) {
- x6.console.group("tabDiv uiNewRow "+this.zTable);
- x6.console.time("tabDiv uiNewRow");
- var skey = x6bb.fwGet('skey_'+this.zTable,-1);
-
- /*
- * If we are currently editing a new row, just
- * focus on it.
- */
- if(skey==0 && x6bb.fwGet('lastSave_'+this.zTable)=='noaction') {
- x6.jqSetFocus(this.rowId(0)+" :input:first:not([disabled])");
- x6.console.log("On an empty new row, setting focus");
- x6.console.groupEnd();
- return;
- }
-
- /*
- * If editing some other row, we know it was saved
- * and is ok, convert it back to display
- */
- if(skey>=0) {
- this.removeInputs();
- }
+ x6.console.group("tabDiv uiNewRow "+this.zTable+", "+tabDivBefore);
+ // Get rid of current row. The removeInputs program
+ // will figure out what it needs to do
+ this.removeInputs();
+
/*
* Pull the empty row and replace all of the values.
*/
- var html = "<div id='"+this.zTable+"_0' style='display:none'>"
+ var html = "<div id='"+this.zTable+"_0' "
+ +" class='selected' style='display:none'>"
+ this.zRowEditHtml
+ "</div>";
- // Here we have an object, not an array, so we iterate by name?
+ // Here we have an object, not an arra...
[truncated message content] |
|
From: <ken...@us...> - 2009-01-21 13:04:36
|
Revision: 1105
http://andro.svn.sourceforge.net/andro/?rev=1105&view=rev
Author: kendowns
Date: 2009-01-21 13:04:26 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
All final changes to x6
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-17 21:50:31 UTC (rev 1104)
+++ trunk/andro/clib/x6.js 2009-01-21 13:04:26 UTC (rev 1105)
@@ -41,46 +41,17 @@
// default value, which would clutter our code with conditionals
//
jQuery.fn.prop = function(propX,defValue) {
- // If they gave us an object, they want to set the
- // properties. We will do a standard jQuery plugin
- // that returns this.each() and sets to all.
- if(typeof(propX)=='object') {
- return this.each(
- function() {
- for(var name in propX) {
- // If they are setting an existing attribute,
- // save it that way, otherwise save it as
- // a JS property.
- var value = propX[name];
- if(typeof(this.attributes[name])!='undefined') {
- this.setAttribute(name,value);
- }
- else {
- this[name] = value;
- }
- }
- }
- );
- }
-
// Otherwise, they must be requesting a property value, so
// we will return a value only for the first matched value
- if(this.length==0) return null;
- var obj = this[0];
if(defValue==null) defValue='';
-
- // First try, maybe it is a direct property
- if(typeof(obj[propX])!='undefined') {
- return obj[propX];
- }
+ if(typeof(this[0])=='undefined') return defValue;
- // second try, an attribute
- if(typeof(obj.attributes[propX])!='undefined') {
- return obj.getAttribute(propX);
- }
+ var retval = $(this[0]).attr(propX);
- // Last chance, return the default they requested
- return defValue;
+ if(typeof(retval)=='undefined')
+ return defValue;
+ else
+ return retval;
};
// Plugin to cancel an event. Can I really have missed
@@ -587,14 +558,7 @@
//e = e ? e : window.event;
var keyLabel = x6.keyLabel(e);
x6.console.group("Document Keydown");
- if(x6bb.fwGet('noKeyPress',false)==keyLabel) {
- x6.console.log("noKeyPress was set, ignoring");
- x6bb.fwSet('noKeyPress',false);
- }
- else {
- // no log entry, key dispatcher does that
- var retval= x6.keyDispatcher(e);
- }
+ var retval= x6.keyDispatcher(e);
x6.console.groupEnd();
return retval;
});
@@ -604,17 +568,7 @@
//e = e ? e : window.event;
x6.console.group("Document Keypress");
var keyLabel = x6.keyLabel(e);
- /*
- if(x6bb.fwGet('noKeyPress',false)==keyLabel) {
- x6.console.log("noKeyPress was set, ignoring");
- x6bb.fwSet('noKeyPress',false);
- }
- else {
- // no log entry, key dispatcher does that
- var retval= x6.keyDispatcher(e);
- }
- */
- var retval= x6.keyDispatcher(e);
+ var retval= x6.keyDispatcher(e);
x6.console.groupEnd();
return retval;
});
@@ -671,7 +625,7 @@
// Possible trapping because of modal dialogs
if(typeof(x6dialogsAllow)=='object') {
if(x6dialogsAllow.indexOf(retval) == -1) {
- e.stopPropagation();
+ $(e).stopPropagation();
return false;
}
}
@@ -685,7 +639,20 @@
window.location.reload(true);
}
+ // IE HARDCODED HACK.
+ // In IE doc-level events are handled by keyDown
+ // (but in firefox by Keypress). When the user hits
+ // DownArrow, it goes to doc level keydown first,
+ // and tries to change rows on a grid. So we trap
+ // for the presence of a drop-down and return early
+ // if we find it while in IE.
+ if(x6inputs.x6select.div) {
+ if(retval=='DownArrow' || retval=='UpArrow') {
+ return;
+ }
+ }
+
// Make list of keys to stop no matter what
var stopThem = [ 'CtrlF5', 'F10' ];
@@ -695,14 +662,22 @@
'CtrlQ', 'CtrlR', 'CtrlU', 'CtrlK',
'CtrlY',
'DownArrow','UpArrow',
- 'ShiftDownArrow','ShiftUpArrow'
+ 'ShiftDownArrow','ShiftUpArrow',
+ 'Ctrl0','Ctrl1','Ctrl2','Ctrl3','Ctrl4',
+ 'Ctrl5','Ctrl6','Ctrl7','Ctrl8','Ctrl9'
];
// Set a flag now. If user hit ESC, we are trying
// to exit the screen, unless somebody tells us we
// cannot do so.
if(retval=='Esc') {
- x6.console.log("Esc key pressed, pre-seting exitApproved=true");
+ if(x6inputs.x6select.div) {
+ x6.console.log("Hit ESC with x6select, clearing it");
+ x6inputs.x6select.hide();
+ $(e).stopPropagation();
+ return false;
+ }
+ x6.console.log("Esc key pressed, pre-setting exitApproved=true");
x6bb.fwSet('exitApproved',true);
}
@@ -710,7 +685,7 @@
if(stopThem.indexOf(retval)>0) {
x6.console.log("x6.keyDispatch: key is in force stop list, stopping propagation.");
x6.console.groupEnd();
- e.stopPropagation();
+ $(e).stopPropagation();
return false;
}
else {
@@ -730,7 +705,7 @@
var str = '?x6page=menu'
+'&x6page_prior='+x6page_prior
+'&x6mod_prior='+x6mod_prior;
- //window.location.replace(str);
+ window.location.replace(str);
}
,10
);
@@ -1718,7 +1693,9 @@
obj.value = this.jdata.html[x];
}
else {
- obj.innerHTML = this.jdata.html[x];
+ // KFD 1/17/09 IE compatibility
+ //obj.innerHTML = this.jdata.html[x];
+ $(obj).html(this.jdata.html[x]);
}
}
}
@@ -2446,7 +2423,7 @@
*
******
*/
- makeMap: true,
+ makeMap: false,
map: [ ],
mapStack: [ ],
mapClear: function() {
@@ -2493,6 +2470,16 @@
return;
}
+ // Hardcoded handling of objectFocus, pull out the object
+ // getting focus and put it at end
+ if(eventName=='objectFocus') {
+ var idx = subscribers.indexOf(arguments);
+ if(idx >= 0) {
+ subscribers.splice(idx,1);
+ subscribers.push(arguments);
+ }
+ }
+
// loop through subscribers. Note at the bottom of the list
// that if an event handler returns false we must stop.
this.retvals[eventName] = true;
@@ -2511,14 +2498,12 @@
var retval = false;
var method = 'receiveEvent_'+eventName;
if(typeof(subscriber[method])=='function') {
- /*
if(this.makeMap) {
var spot = this.mapStack[this.mapStack.length-1];
var len = spot.length;
spot[len] = { name: id, kids: [ ] };
this.mapStack.push(spot[len].kids);
}
- */
retval = subscriber[method](arguments);
x6.console.log(id,eventName,retval);
@@ -3018,7 +3003,9 @@
obj.value = this.jdata.html[x];
}
else {
- obj.innerHTML = this.jdata.html[x];
+ // IE 6 compatibility
+ //obj.innerHTML = this.jdata.html[x];
+ $(obj).html(this.jdata.html[x]);
}
}
}
@@ -3105,7 +3092,7 @@
x6.console.log(inp);
// KFD 1/15/09. Key post-processing. Reformat a date
- var type = $(inp).attr('xtypeid');
+ var type = $(inp).prop('xtypeid');
if(type=='date') {
// this will work until the year 2020
var value = $(inp).attr('value').trim();
@@ -3121,7 +3108,7 @@
else {
year = '19'+year;
}
- $(inp).prop({value:month+'/'+day+'/'+year});
+ $(inp).val(month+'/'+day+'/'+year);
}
}
}
@@ -3174,15 +3161,16 @@
if(x6.p(inp,'xNoPassup','N')=='N') {
if(x6inputs.x6select.div) {
if(keyLabel == 'DownArrow') {
- x6inputs.x6select.display(inp,'Down');
+ x6inputs.x6select.navigate('Down');
}
if(keyLabel == 'UpArrow' ) {
- x6inputs.x6select.display(inp,'Up');
+ x6inputs.x6select.navigate('Up');
}
}
else {
x6.console.log("Going to doc keypress dispatcher.");
var retval= x6.keyDispatcher(e);
+ $(e).stopPropagation();
}
}
x6.console.groupEnd();
@@ -3277,15 +3265,14 @@
json.addParm('x6select','Y');
json.addParm('gpletters',val);
json.execute(true);
- //x6inputs.x6select.display(inp);
- x6inputs.x6select.displayDynamic(inp,x6.data.x6select);
+ x6inputs.x6select.display(inp,null,x6.data.x6select);
x6.console.groupEnd();
}
// Yet another possibility is a lookup on a set
// of fixed values.
if(x6.p(inp,'x6select','N')=='Y' && x6.p(inp,'xValues',null)!=null) {
- x6inputs.x6select.display(inp);
+ x6inputs.x6select.display(inp,'find:'+keyLabel);
}
x6.console.log("Type validation complete, returning true");
@@ -3413,20 +3400,48 @@
},
focus: function(inp) {
- x6.console.group("Input focus ",inp.id);
- x6.console.log("Input: ",inp);
+ x6.console.group("Input focus: "+inp.id);
this.x6select.checkForMe(inp);
inp.zSelected = 1;
inp.zOriginalValue = x6.p(inp,'zOriginalValue','').trim();
inp.lastBlurred = '';
x6inputs.setClass(inp);
- if(x6.p(inp,'zNew',0)==0) {
- x6bb.fwSet('lastFocus_'+x6.p(inp,'xTableId'),inp.id);
+ if(x6.p(inp,'zNew',0)==0 && inp.id.slice(0,7)!='search_') {
+ x6bb.fwSet('lastFocus_'+$(inp).prop('xTableId'),inp.id);
}
- x6.console.log("Input focus DONE");
+ // KFD 1/20/09, remember focus based on current context
+ var objFocus = x6bb.fwGet('objectFocus');
+ x6bb.fwSet('lastFocus_'+objFocus,inp.id);
x6.console.groupEnd();
return true;
},
+ objectFocusBlur: function(objId) {
+ inpId = x6bb.fwGet('lastFocus_'+objId,'');
+ if(inpId != '') {
+ x6.byId(inpId).blur();
+ }
+ },
+ objectFocusFocus: function(objId,jqStr) {
+ if(jqStr==null) jqStr = ':input:not([disabled])';
+ var inpId = x6bb.fwGet('lastFocus_'+objId,'');
+ if(inpId == '') {
+ jqCands = $('#'+objId).find(jqStr+":first");
+ if(jqCands.length>0) {
+ inpId = jqCands[0].id;
+ }
+ }
+ if(inpId != '') {
+ $('#'+inpId).focus();
+ /*
+ setTimeout(
+ function() {
+ x6.byId(inpId).focus();
+ }
+ ,150
+ );
+ */
+ }
+ },
// KFD 11/29/08, not being called anywhere?
//xFocus: function(anyObject) {
// $(this).addCla*ss('selected');
@@ -3593,7 +3608,7 @@
inp.disabled = true;
inp.zNew = 0;
inp.zSelected = 0;
- $(inp).prop({value:''});
+ $(inp).val('');
inp.zOriginalValue = '';
x6inputs.setClass(inp);
},
@@ -3705,200 +3720,156 @@
assignToMe: function(inp) {
if(this.div) {
- var row = $('.x6select tr.hilight');
+ var row = $(this.tbody).find('.hilight>div:first');
if(row.length > 0) {
- $(inp).prop({value:row[0].firstChild.innerHTML});
+ $(inp).val($(row).html());
}
}
},
- display: function(input,fromKeyboard) {
- if(fromKeyboard!=null) {
- if(this.div && this.div.style.display=='block') {
- return this.moveUpOrDown(fromKeyboard);
- }
- }
-
+ display: function(input,kbCommand,rows) {
+ // Step 1: If it does not exist, create it
+ // way off to the left where it cannot
+ // be seen.
if(!this.div) {
this.input = input;
- this.div = document.createElement('DIV');
- this.div.style.display = 'none';
- this.div.style.position = 'absolute';
- this.div.style.backgroundColor = 'white';
- this.div.style.overflow = 'hidden';
- this.div.style.border ="1px solid black";
- var lineHeight = $(input).height();
- this.lineHeight = lineHeight;
- this.div.style.lineHeight = lineHeight+"px";
- this.div.style.cursor = 'pointer';
- this.div.style.zIndex = 1000;
- this.div.className = 'x6select';
+ this.div = document.createElement('div');
+ $(this.div).css({
+ position: 'absolute',
+ left: -2000,
+ backgroundColor: '#ffffff',
+ overflow: 'hidden',
+ border: '1px solid black',
+ cursor: 'pointer',
+ zIndex: 1000
+ });
+ $(this.div).addClass('x6select');
- // Work out minimum width as the input plus the button
- var jqButton = $('[xInputId='+input.id+']');
- if(jqButton.length==0) {
- var minwidth = 10;
- }
- else {
- var minwidth
- = ($(jqButton).offset().left - $(input).offset().left)
- + $(jqButton).width();
- }
- this.div.style.minWidth = minwidth + "px";
-
- // Put in the titles. This is also where we
- // work out the height of the drop-down
- this.div.innerHTML = this.displayTitles(input);
-
// Put in the div, and do the mouse events
document.body.appendChild(this.div);
+ // Put in the titles.
+ this.displayTitles();
+
// This is for optimization, allows us to avoid
// repeatedly making jquery calls for this object
- this.tbody = $('.x6select tbody')[0];
+ this.tbody = $(this.div).find('.tbody')[0];
+ }
- // special routine to populate with fixed
- // values on a pre-populated attribute. If none
- // are there it does nothing.
- this.displayFixed(input);
-
+ // Next possibility is to see if we need to
+ // populate values
+ if(rows!=null) {
+ this.displayDynamic(rows);
}
- // If it is invisible, position it and then make it visible
- if(this.div.style.display=='none') {
- var position = $(input).offset();
- var postop = position.top -1;
- var poslft = position.left;
- this.div.style.top = (postop + input.offsetHeight +1) + "px";
- this.div.style.left = poslft + "px";
- this.div.style.display = 'block';
- this.mouseEvents(input);
+ else {
+ if($(this.tbody).find('div').length==0) {
+ this.displayFixed();
+ }
}
-
- if(fromKeyboard != null) {
- this.moveUpOrDown(fromKeyboard);
+
+ if(kbCommand != null) {
+ this.navigate(kbCommand);
}
else {
- //$(input).focus();
x6.byId(input.id).focus();
}
},
- displayTitles: function(input) {
- // If still here, we have values and descriptions
- var retval = '<table><thead><tr>';
- var descs = x6.p(input,'xTitles').split('|');
+ displayTitles: function() {
+ // use the styles from grid (tabDiv), so we do
+ // not have to reinvent them
+ var retval = '<div class="thead"><div>';
+ var descs = x6.p(this.input,'xTitles').split('|');
for(var idx=0; idx<descs.length; idx++) {
- retval+='<th>'+descs[idx]+'</th>';
+ retval+='<div id="x6head'+idx+'">'+descs[idx]+'</div>';
}
- retval+='<th> ';
-
- // Now work out the height. If static, go by
- // the number of rows, otherwise set it to 16, which
- // is 15 for data and one for titles.
- if(x6.p(input,'x6rowCount',null)!=null) {
- var rowCount = Number(x6.p(input,'x6rowCount'));
- if(rowCount > this.dynRowCount) rowCount = this.dynRowCount;
- }
- else {
- var rowCount = this.dynRowCount;
- }
- this.div.style.height = ((this.lineHeight+3)*(rowCount+1))+"px";
- // ...and the height of the body
- var h = (this.lineHeight + 3)*rowCount;
+ retval+='<div id="x6head'+idx+'"> </div>';
+ retval+="</div></div>"; //close the header line
// Now put out an empty body
- retval+='</thead>'
- +'<tbody style="height: '+h+'px; max-height: '+h+'px; '
- +' overflow-y:scroll">'
- +'</tbody></table>';
- return retval;
+ retval+='<div class="tbody"></div>';
+ $(this.div).html(retval);
},
- displayFixed: function(input) {
- var svals = x6.p(input,'xValues','');
- if(svals.trim()=='') return;
-
- x6.console.log(svals);
- retval = '';
- var rows = svals.split('||');
- for(var idx=0;idx<rows.length;idx++) {
- retval += '<tr>';
- var values = rows[idx].split('|');
- for(var idx2=0;idx2 < values.length; idx2++) {
- retval+= '<td>'+values[idx2];
+ displayFixed: function() {
+ // package the data like it came back from the
+ // database and display it using displayDynamic
+ var svals = $(this.input).attr('xValues');
+ var rows_pre = svals.split('||');
+ var len = rows_pre.length;
+ var rows = [ ];
+ for(var x =0;x<rows_pre.length;x++) {
+ var rowdst = { };
+ var rowsrc = rows_pre[x].split('|');
+ var yend = rowsrc.length;
+ for(var y = 0; y<yend; y++) {
+ rowdst['col'+y] = rowsrc[y];
}
+ rows.push( rowdst );
}
- x6.console.log(retval);
- this.tbody.innerHTML = retval;
+ this.displayDynamic(rows);
},
- displayDynamic: function(input,rows) {
+ displayDynamic: function(rows) {
x6.console.group("In x6input.s6select.displayDynamic");
- x6.console.log(input);
- x6.console.log(rows);
- window.rows = rows;
- // Begin by determining if we will show or hide
- retval = ''
+ // Find out if there is a currently selected row
+ var c=$('.x6select div.x6selrow.hilight > div:first').html();
+
if(rows.length==0) {
- x6.console.log("There are no rows, hiding display");
this.hide();
- //this.tbody.innerHTML = '';
- x6.console.groupEnd();
- return;
}
- this.display(input);
-
- // Find out if there is a currently selected row
- var curVal = '';
- var jqCandidate = $(this.tbody).find("tr.hilight td:first");
- if(jqCandidate.length > 0 ) {
- curVal = jqCandidate[0].innerHTML;
+ else {
+ this.displayDynamicData(rows);
+
+ this.displayDynamicMouseEvents();
+
+ // Now determine if we will highlight a row
+ var doFirst = true;
+ if(c!=null) {
+ var jqCandidate
+ = $(this.tbody).find('div.x6selrow > div:contains('+c+')');
+ if(jqCandidate.length > 0) {
+ $(jqCandidate[0].parentNode).mouseover();
+ doFirst = false;
+ }
+ }
+ if(doFirst) {
+ window.x = this.tbody;
+ $(this.tbody).find('div.x6selrow:first').mouseover();
+ }
+
+ this.displayDynamicMakeVisible();
}
-
+ x6.console.groupEnd();
+ },
+
+ displayDynamicData: function(rows) {
+ var retval = '';
var rows_length = rows.length;
for(var idx in rows) {
- retval += '<tr>';
+ retval += '<div class="x6selrow">';
var values = rows[idx];
+ var idx2ord=0;
for(var idx2 in values) {
+ retval+= '<div class="x6col'+idx2ord+'">';
if(values[idx2] == null) {
- retval+= '<td> ';
+ retval+= ' ';
}
else {
- retval+= '<td>'+values[idx2];
+ retval+= values[idx2].replace(' ',' ');
}
+ retval+= "</div>";
+ idx2ord++;
}
+ retval+="</div>";
}
- var lh = this.lineHeight + 3;
- if(rows.length < this.dynRowCount) {
- this.div.style.height = lh*(rows.length+1) + "px";
- this.tbody.style.height = lh*rows.length + "px";
- }
- else {
- this.div.style.height = lh*(this.dynRowCount+1) + "px";
- this.tbody.style.height = lh*this.dynRowCount + "px";
- }
-
- this.tbody.innerHTML = retval;
- this.mouseEvents(input);
-
- // Now determine if we will highlight a row
- var doFirst = true;
- if(curVal!='') {
- var jqCandidate = $(this.tbody).find('td:contains('+curVal+')');
- if(jqCandidate.length > 0) {
- $(jqCandidate).mouseover();
- doFirst = false;
- }
- }
- if(doFirst) {
- window.x = this.tbody;
- $(this.tbody).find('td:first').mouseover();
- }
- x6.console.groupEnd();
+ $(this.tbody).html(retval);
+ return true;
},
- mouseEvents: function(input) {
- $('.x6select td')
+ displayDynamicMouseEvents: function() {
+ var input = this.input;
+ $(this.tbody).find('div.x6selrow')
.each(
function() {
this.input = input;
@@ -3906,19 +3877,20 @@
)
.mouseover(
function() {
- var rowNow = $('.x6select tr.hilight');
+ var rowNow = $('.x6select div.hilight');
if(rowNow.length > 0) {
if(rowNow[0] == this.parentNode) return;
}
- $('.x6select tr.hilight').removeClass('hilight');
- $(this.parentNode).addClass('hilight');
+ $('.x6select div.hilight').removeClass('hilight');
+ $(this).addClass('hilight');
}
)
.mousedown(
function(e) {
- $(this.input).prop(
- {value:this.parentNode.firstChild.innerHTML}
- );
+ //$(this.input).prop(
+ // {value:this.parentNode.firstChild.innerHTML}
+ //);
+ $(this.input).val(this.firstChild.innerHTML);
x6inputs.afterBlurner(this.input);
x6inputs.x6select.hide();
setTimeout(
@@ -3927,16 +3899,70 @@
}
,100
);
- e.stopPropagation();
+ $(e).stopPropagation();
return false;
}
);
},
- moveUpOrDown: function(direction) {
+ displayDynamicMakeVisible: function() {
+ // obtain height of header, row count, and
+ // total height of rows
+ $(this.tbody).css('height','');
+ var hHeight = $(this.div).find('.thead').height();
+ var rowCount = $(this.div).find('.tbody > div').length;
+ var rHeight = $(this.tbody).find('div.x6selrow div').height();
+
+ // decide how many rows to display
+ var maxRows = rowCount > 15 ? 15 : rowCount;
+
+ // Set the height of the overall div
+ // and the height of the tbody
+ $(this.div).css('height',hHeight + (maxRows * rHeight));
+ $(this.tbody).css('height',maxRows * rHeight);
+
+ // Set column widths
+ var totalWidth = 0;
+ var colCount = $(this.tbody).find('div.x6selrow:last div').length;
+ for(var x = 0; x<= colCount; x++) {
+ var width = $(this.div).find('#x6head'+x).width();
+ totalWidth+=width+8;
+ $(this.div).find('.tbody .x6col'+x).width(width);
+ }
+
+
+ // Now set overall widths
+ //var width = $(this.div).find('.thead div').width();
+ $(this.div).css('width',totalWidth);
+
+ // Now make it visible onscreen
+ var left = $(this.div).css('left');
+ if(left == -2000 || left=='-2000px') {
+ var position = $(this.input).offset();
+ var postop = position.top -1;
+ var poslft = position.left;
+ var postodo = (postop + this.input.offsetHeight +1) + "px";
+ var arg = {top: postodo,left: poslft, display: 'block'};
+ $(this.div).css(arg);
+ }
+ },
+
+ navigate: function(direction) {
+ if(direction.slice(0,4)=='find') {
+ var temp = direction.split(':');
+ var val = temp[1];
+ var jqStr = '.x6select div.x6selrow>div:contains('
+ +val.toUpperCase()
+ +'):first';
+ var jqCell = $(jqStr);
+ if(jqCell.length > 0) {
+ $(jqCell[0].parentNode).mouseover();
+ }
+ return;
+ }
// get current row
- var rowNow = $('.x6select tr.hilight:visible');
- var jqBody = $('.x6select tbody');
+ var rowNow = $('.x6select div.hilight');
+ var jqBody = $('.x6select .tbody');
if(rowNow.length==0) {
$(jqBody[0].firstChild).addClass('hilight');
}
@@ -3946,7 +3972,7 @@
x6.console.log("Up candidate ",candidate);
var rowsBelow = $(rowNow).nextAll().length;
if(rowsBelow > 5) {
- var stNow = $('.x6select tbody').scrollTop();
+ var stNow = $('.x6select .tbody').scrollTop();
$(jqBody).scrollTop(stNow - ( this.lineHeight + 3));
}
}
@@ -3955,13 +3981,13 @@
...
[truncated message content] |
|
From: <ken...@us...> - 2009-01-21 13:31:25
|
Revision: 1119
http://andro.svn.sourceforge.net/andro/?rev=1119&view=rev
Author: kendowns
Date: 2009-01-21 13:31:23 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
Put the timeout back in...
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-21 13:30:12 UTC (rev 1118)
+++ trunk/andro/clib/x6.js 2009-01-21 13:31:23 UTC (rev 1119)
@@ -3432,14 +3432,12 @@
}
if(inpId != '') {
$('#'+inpId).focus();
- /*
setTimeout(
function() {
x6.byId(inpId).focus();
}
- ,150
+ ,50
);
- */
}
},
// KFD 11/29/08, not being called anywhere?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-01-30 02:41:23
|
Revision: 1186
http://andro.svn.sourceforge.net/andro/?rev=1186&view=rev
Author: kendowns
Date: 2009-01-30 02:41:20 +0000 (Fri, 30 Jan 2009)
Log Message:
-----------
oops, had to take out some console.log statements.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-30 02:40:20 UTC (rev 1185)
+++ trunk/andro/clib/x6.js 2009-01-30 02:41:20 UTC (rev 1186)
@@ -464,7 +464,7 @@
* SOURCE
*/
String.prototype.htmlDisplay = function() {
- if(this==null) { console.log('null'); return ''; }
+ if(this==null) return '';
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
}
/******/
@@ -2601,7 +2601,6 @@
},
priorFocus: function() {
- console.log(this.priorObjectFocus);
this.fireEvent('objectFocus',this.priorObjectFocus);
}
}
@@ -4883,7 +4882,6 @@
// tells us where to pull defaults from
$(this).find(':input[xdefsrc]').each(
function() {
- console.log(this.id);
var info = $(this).prop('xdefsrc').split('.');
var row = x6bb.fwGet('dbRow_'+info[0]);
var val = row[info[1]];
@@ -5473,7 +5471,6 @@
}
self.uiRowSaved_readOnly = function(row) {
- console.log(row);
var skey = row.skey;
// DUPLICATE CODE ALERT
// This code is also present in PHP androLib.php
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-02 16:21:43
|
Revision: 1213
http://andro.svn.sourceforge.net/andro/?rev=1213&view=rev
Author: kendowns
Date: 2009-02-02 16:21:39 +0000 (Mon, 02 Feb 2009)
Log Message:
-----------
fix to saving users in groups -- underlying issue was fix to x6ref save.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-01-30 21:06:25 UTC (rev 1212)
+++ trunk/andro/clib/x6.js 2009-02-02 16:21:39 UTC (rev 1213)
@@ -6373,7 +6373,7 @@
// Here we have all of the values we need to make
// a literal command to the back to either insert
// or delete a row.
- var json = new x6JSON('x6table',args.x6table);
+ var json = new x6JSON('x6page',args.x6table);
json.addParm('x6action','checkboxSave');
json.addParm('checked',inp.checked);
json.addParm('cbval_'+args.pkl,args.pkvalleft);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-06 17:11:49
|
Revision: 1222
http://andro.svn.sourceforge.net/andro/?rev=1222&view=rev
Author: kendowns
Date: 2009-02-06 17:11:46 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
Added more keys to the do-not-propagate list, simplified the x6.json.inputs() routine to remove old x2 and x4 clutter, and to send back all values, not just changed values.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-04 02:52:45 UTC (rev 1221)
+++ trunk/andro/clib/x6.js 2009-02-06 17:11:46 UTC (rev 1222)
@@ -681,6 +681,7 @@
// Make list of keys to stop no matter what
var stopThem = [ 'CtrlF5', 'F10' ];
+ var stopThem = [ ];
var noPropagate = [
'CtrlS', 'CtrlN', 'CtrlI', 'CtrlD',
@@ -690,7 +691,8 @@
'DownArrow','UpArrow',
'ShiftDownArrow','ShiftUpArrow',
'Ctrl0','Ctrl1','Ctrl2','Ctrl3','Ctrl4',
- 'Ctrl5','Ctrl6','Ctrl7','Ctrl8','Ctrl9'
+ 'Ctrl5','Ctrl6','Ctrl7','Ctrl8','Ctrl9',
+ 'F1','F2','F3','F4','F6','F7','F8','F9','F10'
];
// Set a flag now. If user hit ESC, we are trying
@@ -1349,14 +1351,6 @@
*/
inputs: function(obj,direct) {
if(direct==null) direct=false;
- if(obj==null) {
- if(x6.byId('x4Top')!=null) {
- obj = x6.byId('x4Top');
- }
- else {
- obj = $('.x6main')[0];
- }
- }
if(typeof(obj)=='string') {
if(obj.indexOf('input')==-1) {
var jqObjects = $(obj).find(':input');
@@ -1369,33 +1363,7 @@
var jqObjects = $(obj).find(":input");
}
jqObjects.each( function() {
- if(direct)
- var id = 'x4c_'+x6.p(this,'xColumnId');
- else
- var id = this.id;
-
-
- if(this.type=='checkbox') {
- if(this.checked) {
- x6.json.addParm(id,'Y');
- }
- else {
- x6.json.addParm(id,'N');
- }
- }
- else {
- if(typeof(x6)=='undefined') {
- if($(this).prop('value')!='') {
- x6.json.addParm(id,$(this).prop('value'));
- }
- }
- else {
- var zOrig = x6.p(this,'zOriginalValue','').trim();
- if($(this).prop('value').trim()!=zOrig) {
- x6.json.addParm(id,$(this).prop('value'));
- }
- }
- }
+ x6.json.addParm(this.id,$(this).val());
});
},
/******/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-11 17:18:29
|
Revision: 1231
http://andro.svn.sourceforge.net/andro/?rev=1231&view=rev
Author: kendowns
Date: 2009-02-11 17:18:26 +0000 (Wed, 11 Feb 2009)
Log Message:
-----------
Corrections to x6select: column widths, and assignment of value to input.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-11 17:17:20 UTC (rev 1230)
+++ trunk/andro/clib/x6.js 2009-02-11 17:18:26 UTC (rev 1231)
@@ -3756,7 +3756,7 @@
if(this.div) {
var row = $(this.tbody).find('.hilight>div:first');
if(row.length > 0) {
- $(inp).val($(row).html());
+ $(inp).val($(row).html().htmlEdit());
}
}
},
@@ -3924,7 +3924,7 @@
//$(this.input).prop(
// {value:this.parentNode.firstChild.innerHTML}
//);
- $(this.input).val(this.firstChild.innerHTML);
+ $(this.input).val(this.firstChild.innerHTML.htmlEdit());
x6inputs.afterBlurner(this.input);
x6inputs.x6select.hide();
setTimeout(
@@ -3959,9 +3959,23 @@
var totalWidth = 0;
var colCount = $(this.tbody).find('div.x6selrow:last div').length;
for(var x = 0; x<= colCount; x++) {
- var width = $(this.div).find('#x6head'+x).width();
- totalWidth+=width+8;
- $(this.div).find('.tbody .x6col'+x).width(width);
+ if(x==colCount) {
+ maxWidth=15;
+ }
+ else {
+ var maxWidth=0;
+ $(this.tbody).find('div.x6col'+x).each(
+ function() {
+ if($(this).width() > maxWidth)
+ maxWidth = $(this).width();
+ }
+ );
+ }
+ //var width = $(this.div).find('#x6head'+x).width();
+ totalWidth+=maxWidth+8;
+ //$(this.div).find('.tbody .x6col'+x).width(width);
+ $(this.div).find('.tbody .x6col'+x).width(maxWidth);
+ $(this.div).find('#x6head'+x).width(maxWidth);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-12 18:35:21
|
Revision: 1233
http://andro.svn.sourceforge.net/andro/?rev=1233&view=rev
Author: kendowns
Date: 2009-02-12 18:35:17 +0000 (Thu, 12 Feb 2009)
Log Message:
-----------
Small tweak to x6select.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-11 17:19:10 UTC (rev 1232)
+++ trunk/andro/clib/x6.js 2009-02-12 18:35:17 UTC (rev 1233)
@@ -3963,7 +3963,7 @@
maxWidth=15;
}
else {
- var maxWidth=0;
+ var maxWidth=$(this.div).find('#x6head'+x).width();
$(this.tbody).find('div.x6col'+x).each(
function() {
if($(this).width() > maxWidth)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-13 18:05:12
|
Revision: 1236
http://andro.svn.sourceforge.net/andro/?rev=1236&view=rev
Author: kendowns
Date: 2009-02-13 18:05:09 +0000 (Fri, 13 Feb 2009)
Log Message:
-----------
Changes For Release Candidate 1 Docs
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-12 18:37:06 UTC (rev 1235)
+++ trunk/andro/clib/x6.js 2009-02-13 18:05:09 UTC (rev 1236)
@@ -180,7 +180,7 @@
\* **************************************************************** */
-/****M* Javascript-API/Date-Extensions
+/****M* Javascript API/Date-Extensions
*
* NAME
* Date-Extensions
@@ -227,7 +227,7 @@
/******/
-/****M* Javascript-API/String-Extensions
+/****M* Javascript API/String-Extensions
*
* NAME
* String-Extensions
@@ -515,7 +515,7 @@
X6 Object
\* **************************************************************** */
-/****o* Javascript-API/x6
+/****o* Javascript API/x6
*
* NAME
* x6
@@ -1818,10 +1818,10 @@
if(readCookie('log_Warn') ==1) x6.console.enableWarn = true;
if(readCookie('log_Error')==1) x6.console.enableError = true;
-/****O* Javascript-API/x6dialogs
+/****O* Javascript API/x6dialogs
*
* NAME
-* Javascript-API/x6dialogs
+* Javascript API/x6dialogs
*
* FUNCTION
* The two Javascript dialogs x6dialogs.alert and
@@ -2113,7 +2113,7 @@
}
}
-/****O* Javascript-API/x6bb
+/****O* Javascript API/x6bb
* NAME
* x6bb
*
@@ -2241,7 +2241,7 @@
}
-/****O* Javascript-API/x6events
+/****O* Javascript API/x6events
*
* NAME
* x6events
@@ -4049,7 +4049,7 @@
\* **************************************************************** */
-/****O* Javascript-API/x6plugins
+/****O* Javascript API/x6plugins
*
* NAME
* x6plugins
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-17 20:50:43
|
Revision: 1250
http://andro.svn.sourceforge.net/andro/?rev=1250&view=rev
Author: kendowns
Date: 2009-02-17 20:50:41 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Sourceforge bug 2589696, x6select was not scrolling.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-17 17:29:35 UTC (rev 1249)
+++ trunk/andro/clib/x6.js 2009-02-17 20:50:41 UTC (rev 1250)
@@ -4011,6 +4011,8 @@
// get current row
var rowNow = $('.x6select div.hilight');
var jqBody = $('.x6select .tbody');
+ // get the height of a row
+ var lineHeight = $('.x6select .tbody > div > div:first').height()
if(rowNow.length==0) {
$(jqBody[0].firstChild).addClass('hilight');
}
@@ -4021,7 +4023,7 @@
var rowsBelow = $(rowNow).nextAll().length;
if(rowsBelow > 5) {
var stNow = $('.x6select .tbody').scrollTop();
- $(jqBody).scrollTop(stNow - ( this.lineHeight + 3));
+ $(jqBody).scrollTop(stNow - ( lineHeight + 3));
}
}
else {
@@ -4030,7 +4032,7 @@
var rowsAbove = $(rowNow).prevAll().length;
if(rowsAbove > 5) {
var stNow = $(jqBody).scrollTop();
- $(jqBody).scrollTop(stNow + this.lineHeight + 3);
+ $(jqBody).scrollTop(stNow + lineHeight + 3);
}
}
x6.console.log("row now ",rowNow);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-17 21:08:39
|
Revision: 1251
http://andro.svn.sourceforge.net/andro/?rev=1251&view=rev
Author: kendowns
Date: 2009-02-17 21:08:31 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Sourceforge bug 2610193. Sorting on a search grid was not respecting filters.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-17 20:50:41 UTC (rev 1250)
+++ trunk/andro/clib/x6.js 2009-02-17 21:08:31 UTC (rev 1251)
@@ -5916,27 +5916,15 @@
*/
self.fetch = function(doFetch) {
if(doFetch==null) doFetch=false;
- var cntNoBlank = 0;
// Initialize and then scan
- var json = new x6JSON('x6page',this.zTable);
- $(this).find(".thead :input").each(function() {
- if(typeof(this.zValue)=='undefined')
- this.zValue = this.getAttribute('xValue');
- if($(this).prop('value')!=this.zValue) {
- doFetch = true;
- }
- if($(this).prop('value')!='') {
- cntNoBlank++;
- }
- this.zValue = $(this).prop('value');
- json.addParm('x6w_'+x6.p(this,'xColumnId'),$(this).prop('value'));
- });
+ var json = new x6JSON('x6page',this.zTable);
+ this.addFilters(json);
- if(doFetch) {
+ if(this.doFetch) {
// Clear the previous results
x6.data.browseFetchHtml = '';
- if(cntNoBlank==0) {
+ if(this.cntNoBlank==0) {
$(this).find('.tbody').html('');
return;
}
@@ -5986,6 +5974,9 @@
json.addParm('tableIdPar',tablePar );
json.addParm('skeyPar' ,skeyPar );
}
+
+ // Fetch the filters as well
+ this.addFilters(json);
json.addParm('x6action','browseFetch');
json.addParm('xGridHeight',x6.p(this,'xGridHeight'));
@@ -6002,6 +5993,24 @@
delete json;
x6dialogs.clear();
}
+
+ self.addFilters = function(json) {
+ this.doFetch = false;
+ this.cntNoBlank = 0;
+ var grid = this;
+ $(this).find(".thead :input").each(function() {
+ if(typeof(this.zValue)=='undefined')
+ this.zValue = this.getAttribute('xValue');
+ if($(this).prop('value')!=this.zValue) {
+ grid.doFetch = true;
+ }
+ if($(this).prop('value')!='') {
+ grid.cntNoBlank++;
+ }
+ this.zValue = $(this).prop('value');
+ json.addParm('x6w_'+x6.p(this,'xColumnId'),$(this).prop('value'));
+ });
+ }
/* --------------------------------------------------------------- */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-17 21:18:17
|
Revision: 1252
http://andro.svn.sourceforge.net/andro/?rev=1252&view=rev
Author: kendowns
Date: 2009-02-17 21:18:15 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Sourceforge bug 2568464. Sorted search results were coming back wrong size.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-17 21:08:31 UTC (rev 1251)
+++ trunk/andro/clib/x6.js 2009-02-17 21:18:15 UTC (rev 1252)
@@ -5928,14 +5928,7 @@
$(this).find('.tbody').html('');
return;
}
- //x6.json.addParm('x6action' ,'browseFetch');
- //x6.json.addParm('xSortable' ,'N');
- //x6.json.addParm('xReturnAll' ,'N');
- json.addParm('x6action' ,'browseFetch');
- json.addParm('xSortable' ,x6.p(this,'xSortable' ,'N'));
- json.addParm('xReturnAll' ,'N');
- json.addParm('xGridHeight',x6.p(this,'xGridHeight',500));
- json.addParm('xLookups' ,x6.p(this,'xLookups' ,'N'));
+ this.gridParms(json);
// Add the "exact match" parm if it is part of the
// the grid. Notice it is a one-timer
@@ -5977,12 +5970,8 @@
// Fetch the filters as well
this.addFilters(json);
-
- json.addParm('x6action','browseFetch');
- json.addParm('xGridHeight',x6.p(this,'xGridHeight'));
- json.addParm('xSortable' ,x6.p(this,'xSortable' ));
- json.addParm('xReturnAll' ,x6.p(this,'xReturnAll' ));
- json.addParm('xButtonBar' ,x6.p(this,'xButtonBar','N'));
+ this.gridParms(json);
+
json.addParm('sortCol',args.sortCol);
json.addParm('sortAsc',args.sortAsc);
x6dialogs.pleaseWait();
@@ -6011,6 +6000,14 @@
json.addParm('x6w_'+x6.p(this,'xColumnId'),$(this).prop('value'));
});
}
+ self.gridParms = function(json) {
+ json.addParm('x6action' ,'browseFetch');
+ json.addParm('xSortable' ,x6.p(this,'xSortable' ,'N'));
+ json.addParm('xReturnAll' ,x6.p(this,'xReturnAll' ,'N'));
+ json.addParm('xGridHeight',x6.p(this,'xGridHeight',500));
+ json.addParm('xLookups' ,x6.p(this,'xLookups' ,'N'));
+ json.addParm('xButtonBar' ,x6.p(this,'xButtonBar','N'));
+ }
/* --------------------------------------------------------------- */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ken...@us...> - 2009-02-18 14:28:50
|
Revision: 1254
http://andro.svn.sourceforge.net/andro/?rev=1254&view=rev
Author: kendowns
Date: 2009-02-18 14:28:42 +0000 (Wed, 18 Feb 2009)
Log Message:
-----------
Sourceforge bug 2547824.
Modified Paths:
--------------
trunk/andro/clib/x6.js
Modified: trunk/andro/clib/x6.js
===================================================================
--- trunk/andro/clib/x6.js 2009-02-17 23:36:15 UTC (rev 1253)
+++ trunk/andro/clib/x6.js 2009-02-18 14:28:42 UTC (rev 1254)
@@ -6053,17 +6053,10 @@
// other tab while processing is going on.
tabs.disableAll([ui.index]);
- // If we set objectfocus to '--null--', we turn off events
- // for all objects, which is good, user can't go clicking
- // things during animations. But if they clicked 'hide'
- // we turn the parent back on.
+ // Set object focus to --null--, which turns off all
+ // objects during animation.
var tablePar = x6.p(tabs,'x6parentTable');
- if(ui.index > 0) {
- x6events.fireEvent('objectFocus','--null--');
- }
- else {
- x6events.fireEvent('objectFocus','ddisp_'+tablePar);
- }
+ x6events.fireEvent('objectFocus','--null--');
var topPane = x6.p(tabs,'x6slideUp');
var tpi = x6.p(tabs,'x6slideUpInner');
@@ -6092,6 +6085,9 @@
},
slideUp: function(tabsUl,event,ui,topPane,topPaneI) {
+ // This is animation speed
+ var spd = 400;
+
var obj = x6.byId(topPane);
if(typeof(obj.currentChild)=='undefined') obj.currentChild='*';
var currentChild = obj.currentChild
@@ -6100,65 +6096,121 @@
// if UI.index = 0, they clicked hide.
if(ui.index==0) {
if(currentChild!='*') {
+ // KFD 2/18/09 Sourceforge 2547824
+ // THIS IS IN FINAL FORM. LOOKS GOOD. WORKS.
+ // Sliding tabs around works much better if we first
+ // slide up the inner content, then slide everything
+ // else down.
var newHeight = $('#'+topPane).height()+350;
var newHeightI= $('#'+topPaneI).height()+350;
- $('#'+topPaneI).animate( {height: newHeightI},500,null
- ,function() { $(this).css('overflow-y','scroll'); }
+ $('#'+currentChild).slideUp(200
+ ,function() {
+ // Wait 1/10 of a second and start slidin
+ // the top-outer container down
+ setTimeout(
+ function() {
+ $('#'+topPane).animate(
+ {height: newHeight}
+ ,spd
+ );
+ }
+ ,100
+ );
+ // Wait another 1/10 of a second and start sliding
+ // the top-inner container down. Do all wrap-up
+ // when that is finished.
+ setTimeout(
+ function() {
+ var pt
+ = 'ddisp_'
+ + $(tabsUl).prop('x6parenttable');
+ $('#'+topPaneI).animate(
+ {height: newHeightI}
+ ,spd
+ ,null
+ ,function() {
+ $(this).css('overflow-y','scroll');
+ obj.currentChild = '*';
+ tabsUl.enableAll();
+ x6events.fireEvent(
+ 'objectFocus'
+ ,pt
+ );
+ }
+ );
+ }
+ ,200
+ );
+ }
);
- $('#'+topPane).animate( {height: newHeight},500);
- obj.currentChild = '*';
- tabsUl.enableAll();
- $('#'+currentChild).css('overflow','hidden').height(3);
- x6events.fireEvent(
- 'objectFocus','ddisp_'+$(tabsUl).prop('x6parenttable')
- );
return true;
}
}
- // Make the current tab effectively invisible
- $(ui.panel).css('overflow','hidden').height(3);
-
-
// If no tab, slide up and slide down
if(currentChild=='*') {
var newHeight = $('#'+topPane).height()-350;
var newHeightI= $('#'+topPaneI).height()-350;
- setTimeout(function() {
- $('#'+topPaneI).animate( {height: newHeightI},500,null
- ,function() {
- $(this).css('overflow-y','scroll');
- }
- );
- },100);
- $('#'+topPane).animate( {height: newHeight},500 );
- var newHeight=$(ui.panel).height()+350;
- setTimeout(function() {
- $(ui.panel).animate({height: newHeight},500,null
+
+ // KFD 2/18/09. Sourceforge 2547824
+ // Apparently jQuery loses track of how high an inner
+ // tab should be (or we are not telling it properly).
+ // If a tab was previously displayed and is now
+ // being displayed again, we have to set the height to
+ // 0 before starting, otherwise it ends up twice as
+ // high as it should be.
+ $(ui.panel).height(0);
+
+ // Begin the inner immediately
+ $('#'+topPaneI).animate( {height: newHeightI},spd,null
+ ,function() {
+ $(this).css('overflow-y','scroll');
+ }
+ );
+ // Wait 1/10 of a second and start sliding up the
+ // outer top pane.
+ setTimeout(
+ function() {
+ $('#'+topPane).animate( {height: newHeight},spd );
+ }
+ ,100
+ );
+
+ // Wait another 1/10 of a second and slide down the
+ // tab itself as an animate.
+ var newHeightT=$(ui.panel).height()+350;
+ var newheightT = 353;
+ setTimeout(
+ function() {
+ $(ui.panel).animate({height: newHeightT},spd,null
,function() {
x6tabs.slideUpData(tabsUl,newChild,newHeight);
+ x6.byId(topPane).currentChild = newChild;
}
);
- },200);
- x6.byId(topPane).currentChild = newChild;
+ }
+ ,200
+ );
return true;
}
// If we are still here, they picked one child tab
- // while another was still open. We have to drop down
- // the selected tab. We have to do this even if they
- // swap around between tabs, because jQuery restores the
- // original height (3px or so) when it hides a tab.
+ // while another was still open. We have to slide up
+ // the current tab, then animate the new one down,
+ // then we call for data.
var newHeight=$(ui.panel).height()+350;
- setTimeout(function() {
- $(ui.panel).animate({height: newHeight},500,null
+ var newHeightT = 353;
+ $('#'+currentChild).slideUp(200
+ ,function() {
+ $(ui.panel).animate({height: newHeightT},400,null
,function() {
x6tabs.slideUpData(tabsUl,newChild,newHeight);
+ x6.byId(topPane).currentChild = newChild;
}
);
- $('#'+currentChild).css('overflow','hidden').height(3);
- },100);
- x6.byId(topPane).currentChild = newChild;
+ }
+ );
+
return true;
},
@@ -6645,39 +6697,7 @@
var mw = $('#x6modal').width();
var ww = $(window).width();
var wh = $(window).height();
-
- /*
- // Make sure the width is at least the title
- // and the link
- var h1w = $('#x6modal .x6modaltop b').width();
- var aw = $('#x6modal .x6modaltop a').width();
- if(mw < (h1w + aw +40)) {
- mw = h1w + aw + 40;
- $('#x6modal').css('width',mw);
- }
- // Make sure the height is at least 1/2 of the window
- if(mh < (wh/2)) {
- mh = Math.floor(wh/2);
- $('#x6modal').css('height',mh);
- }
- // Make sure height is notmore than window less 100
- if(mh > (wh - 100)) {
- mh = wh - 100;
- $('#x6modal').css('height',mh);
- }
-
- // Unconditionally set the inner height, who knows
- // where its gone off to.
- var ihNew = mh - $('#x6modal .x6modaltop').height();
- ihNew -= Number($(mObj).attr('xSpacing'));
-
- if(ih > ihNew) {
- $('#x6modal .x6modalinner').css('overflow-y','scroll');
- }
- $('#x6modal .x6modalinner').css('height',ihNew);
- */
-
// now center this guy.
var left = Math.floor( (ww-mw)/2 );
$('#x6modal')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|