diff --git a/www/extras/yui-webgui/build/friendManager/friendManager.js b/www/extras/yui-webgui/build/friendManager/friendManager.js new file mode 100644 index 000000000..c318ac299 --- /dev/null +++ b/www/extras/yui-webgui/build/friendManager/friendManager.js @@ -0,0 +1,112 @@ +/*** The WebGUI Asset History Viewer + * Requires: YAHOO, Dom, Event + * With all due credit to Doug Bell, who wrote the AssetManager. FriendManager + * is a blatant copy/paste/modify of it. + */ + +//Container for functions used by many datatables. +if ( typeof WebGUI == "undefined" ) { + WebGUI = {}; +} +if ( typeof WebGUI.FriendManager == "undefined" ) { + WebGUI.FriendManager = {}; +} + +/*--------------------------------------------------------------------------- + WebGUI.FriendManager.initManager ( ) + Initialize the i18n interface +WebGUI.FriendManager.initManager = function (o) { + WebGUI.FriendManager.i18n + = new WebGUI.i18n( { + namespaces : { + 'WebGUI' : [ + "50", + ], + 'Account_Friends' : [ + "title", + ] + }, + onpreload : { + fn : WebGUI.FriendManager.init + } + } ); +}; +*/ + +/*--------------------------------------------------------------------------- + Initialize objects that are shared across many datatables. +*/ +WebGUI.FriendManager.responseSchema + = { + resultsList: 'records', + fields: [ + { key: 'userId', parser: 'string' }, + { key: 'username', parser: 'string' }, + { key: 'friends', parser: 'number' }, + ], + metaFields: { + totalRecords: "recordsReturned" // Access to value in the server response + } + }; + +WebGUI.FriendManager.formatUsername = function ( el, oRecord, oColumn, oData ) { +// var link = document.createElement('a'); +// var myId = YAHOO.util.Dom.generateId(); +// elCell.innerHTML = ''; +// var editButton = new YAHOO.widget.Button( myId, +// { +// type : "link", +// href : "?op=account;module=friendManager;do=editFriends;uid="+oRecord.getData('userId'), +// label : "EDIT", +// } +// ); + var userId = oRecord.getData('userId'); + el.innerHTML = 'edit '; + el.innerHTML += '' + oData + ''; +} + +WebGUI.FriendManager.ColumnDefs = [ // sortable:true enables sorting + //{key:"username", label:WebGUI.FriendManager.i18n.get('WebGUI', '50' ), sortable: true}, + //{key:"friends", label:WebGUI.FriendManager.i18n.get('Account_Friends', 'title' ), sortable: true}, + {key:"username", label:"username", sortable: true, formatter: WebGUI.FriendManager.formatUsername }, + {key:"friends", label:"friends", sortable: true}, + {key:"userId", label:"userId", sortable: true}, +]; + +//Per object code + +WebGUI.FriendManager.MakeTable = function (groupId, containerId) { + var that = this; + + // Initialize the data table + var myPaginator = new YAHOO.widget.Paginator({ + containers : ['pagination'], + pageLinks : 7, + rowsPerPage : 15, + template : "{CurrentPageReport} {PreviousPageLink} {PageLinks} {NextPageLink}" + }); + + that.DataSource + = new YAHOO.util.DataSource('?op=account;module=friendManager;do=getFriendsAsJson;groupId='+groupId+';',{connTimeout:30000} ); + that.DataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; + that.DataSource.responseSchema = WebGUI.FriendManager.responseSchema; + that.DataTable = new YAHOO.widget.DataTable( + containerId, + WebGUI.FriendManager.ColumnDefs, + that.DataSource, + { + initialRequest : '', + paginator : myPaginator, + sortedBy : { "key" : "username", "dir" : YAHOO.widget.DataTable.CLASS_ASC }, + } + ); + + that.DataTable.handleDataReturnPayload = function(oRequest, oResponse, oPayload) { + oPayload.totalRecords = oResponse.meta.totalRecords; + return oPayload; + } + + return that; + +}; +