preparing for 2.6 yui upgrade
This commit is contained in:
parent
eea207b3ec
commit
a041e93da8
1632 changed files with 0 additions and 812103 deletions
|
|
@ -1 +0,0 @@
|
|||
<html><body></body></html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 53 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 94 B |
Binary file not shown.
|
Before Width: | Height: | Size: 94 B |
Binary file not shown.
|
Before Width: | Height: | Size: 94 B |
Binary file not shown.
|
Before Width: | Height: | Size: 94 B |
490
www/extras/yui/examples/datatable/assets/js/data.js
vendored
490
www/extras/yui/examples/datatable/assets/js/data.js
vendored
|
|
@ -1,490 +0,0 @@
|
|||
YAHOO.example.Data = {
|
||||
apitester: [
|
||||
{number:0, date:new Date(1999, 1, 1), string:"1"},
|
||||
{number:1, date:new Date(1999, 10, 10), string:"12"},
|
||||
{number:2, date:new Date(2000, 1, 1), string:"123"},
|
||||
{number:3, date:new Date(2000, 10, 1), string:"10"},
|
||||
{number:4, date:new Date(2001, 10, 12), string:"1"},
|
||||
{number:5, date:new Date(2001, 1, 12), string:"123"},
|
||||
{number:6, date:new Date(2001, 10, 1), string:"11"},
|
||||
{number:7, date:new Date(2001, 10, 1), string:"16"},
|
||||
{number:8, date:new Date(2001, 10, 1), string:"8"},
|
||||
{number:9, date:new Date(2001, 10, 1), string:"6"},
|
||||
{number:10, date:new Date(2001, 10, 1), string:"66"},
|
||||
{number:11, date:new Date(2001, 10, 1), string:"111"},
|
||||
{number:12, date:new Date(2001, 10, 1), string:"110"}
|
||||
],
|
||||
|
||||
multitypes: {
|
||||
items: [
|
||||
{field1: "bananas", field2:new Date(2007, 1, 1), field3:111, field4:"23.4", field5:"bob", field6:"http://www.yahoo.com"},
|
||||
{field1: undefined, field2:new Date(2006, 1, 1), field3:12.3, field4:"35.12", field5:"ann", field6:"http://www.yahoo.com"},
|
||||
{field1: "apples", field2:new Date(2007, 11, 1), field3:1, field4:34.12, field5:"charlie", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:new Date(2007, 1, 11), field3:1112, field4:"03", field5:"diane", field6:"http://www.yahoo.com"},
|
||||
{field1: "cherries", field2:new Date(1999, 1, 11), field3:124, field4:03, field5:"edgar", field6:"http://www.yahoo.com"},
|
||||
{field1: "", field2:"January 10, 2005", field3:"12", field4:"34", field5:"francine", field6:"http://www.yahoo.com"},
|
||||
{field1: "unknown", field2:"January 1, 2005", field3:"19.1", field4:"234.5", field5:"george", field6:"http://www.yahoo.com"},
|
||||
{field1: null, field2:"1/11/05", field3:"10.02", field4:"345.654", field5:"hannah", field6:"http://www.yahoo.com"},
|
||||
{field1: "cherries", field2:"1/11/2005", field3:"109", field4:23.456, field5:"igor", field6:"http://www.yahoo.com"},
|
||||
{field1: "bananas", field2:"November 1, 2005", field3:"11111", field4:23.0123, field5:"julie", field6:"http://www.yahoo.com"}
|
||||
]
|
||||
},
|
||||
|
||||
webstats: [
|
||||
["home.html",20,400,44,657],
|
||||
["blog.html",24,377,97,567],
|
||||
["contact.html",32,548,42,543],
|
||||
["about.html",8,465,12,946],
|
||||
["pagenotfound.html",0,0,0,0]
|
||||
],
|
||||
|
||||
emails: {
|
||||
account:"jenny@yahoo.com",
|
||||
currStorage: 10,
|
||||
maxStorage: 200,
|
||||
messages: [
|
||||
{XID: "9897",Date:new Date(1981, 2, 24),To:"Joe",From:"Jenny",Unread:false,Subject:"Check out my new pictures"},
|
||||
{XID: "7899",Date:new Date(1980, 1, 11),To:"Jane",From:"Jenny",Unread:false,Subject:"Let's have lunch"},
|
||||
{XID: "6789",Date:new Date(1978, 11, 12),To:"Ann",From:"Jenny",Unread:false,Subject:"Here's the info you requested"},
|
||||
{XID: "4996",Date:new Date(1974, 1, 11),To:"Bob",From:"Jenny",Unread:true,Subject:"RE: Let's have lunch"},
|
||||
{XID: "4544",Date:new Date(1974, 1, 10),To:"Charlie",From:"Jenny",Unread:false,Subject:"Birthday party Saturday"}
|
||||
]
|
||||
},
|
||||
|
||||
inventory: [
|
||||
{SKU:"23-23874", Quantity:43, Item:"Helmet", Description:"Red baseball helmet. Size: Large."},
|
||||
{SKU:"48-38835", Quantity:84, Item:"Football", Description:"Leather football."},
|
||||
{SKU:"84-84848", Quantity:31, Item:"Goggles", Description:"Light blue swim goggles"},
|
||||
{SKU:"84-84843", Quantity:56, Item:"Badminton Set", Description:"Set of 2 badminton rackets, net, and 3 birdies."},
|
||||
{SKU:"84-39321", Quantity:128, Item:"Tennis Balls", Description:"Canister of 3 tennis balls."},
|
||||
{SKU:"39-48949", Quantity:55, Item:"Snowboard", Description:""},
|
||||
{SKU:"99-28128", Quantity:77, Item:"Cleats", Description:"Soccer cleats. Size: 10."},
|
||||
{SKU:"83-48281", Quantity:65, Item:"Volleyball", Description:""},
|
||||
{SKU:"89-32811", Quantity:12, Item:"Sweatband", Description:"Blue sweatband. Size: Medium."},
|
||||
{SKU:"28-22847", Quantity:43, Item:"Golf Set", Description:"Set of 9 golf clubs and bag."},
|
||||
{SKU:"38-38281", Quantity:1, Item:"Basketball Shorts", Description:"Green basketball shorts. Size: Small."},
|
||||
{SKU:"82-38333", Quantity:288, Item:"Lip balm", Description:"Lip balm. Flavor: Cherry."},
|
||||
{SKU:"21-38485", Quantity:177, Item:"Ping Pong Ball", Description:""},
|
||||
{SKU:"83-38285", Quantity:87, Item:"Hockey Puck", Description:"Glow-in-the-dark hockey puck."}
|
||||
],
|
||||
|
||||
addresses: [
|
||||
{name:"John A. Smith", address:"1236 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan B. Jones", address:"3271 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob C. Uncle", address:"9996 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John D. Smith", address:"1623 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan E. Jones", address:"3217 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob F. Uncle", address:"9899 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John G. Smith", address:"1723 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan H. Jones", address:"3241 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob I. Uncle", address:"9909 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John J. Smith", address:"1623 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan K. Jones", address:"3721 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob L. Uncle", address:"9989 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John M. Smith", address:"1293 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan N. Jones", address:"3621 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob O. Uncle", address:"9959 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"},
|
||||
{name:"John P. Smith", address:"6123 Some Street", city:"San Francisco", state:"CA", amount:5, active:"yes", colors:["red"], last_login:"4/19/2007"},
|
||||
{name:"Joan Q. Jones", address:"3281 Another Ave", city:"New York", state:"NY", amount:3, active:"no", colors:["red","blue"], last_login:"2/15/2006"},
|
||||
{name:"Bob R. Uncle", address:"9989 Random Road", city:"Los Angeles", state:"CA", amount:0, active:"maybe", colors:["green"], last_login:"1/23/2004"}
|
||||
],
|
||||
|
||||
bookorders: [
|
||||
{id:"po-0167", date:new Date(1980, 2, 24), quantity:1, amount:4, title:"A Book About Nothing"},
|
||||
{id:"po-0783", date:new Date("January 3, 1983"), quantity:null, amount:12.12345, title:"The Meaning of Life"},
|
||||
{id:"po-0297", date:new Date(1978, 11, 12), quantity:12, amount:1.25, title:"This Book Was Meant to Be Read Aloud"},
|
||||
{id:"po-1482", date:new Date("March 11, 1985"), quantity:6, amount:3.5, title:"Read Me Twice"}
|
||||
],
|
||||
|
||||
stateAbbrs: [
|
||||
"AL","AK","AZ","AR","CA","CO","CT","DE","DC","FL","GA","HI",
|
||||
"ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS",
|
||||
"MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR",
|
||||
"PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
|
||||
],
|
||||
|
||||
areacodes: [
|
||||
{areacode: "201", state: "New Jersey"},
|
||||
{areacode: "202", state: "Washington, DC"},
|
||||
{areacode: "203", state: "Connecticut"},
|
||||
{areacode: "204", state: "Manitoba, Canada"},
|
||||
{areacode: "205", state: "Alabama"},
|
||||
{areacode: "206", state: "Washington"},
|
||||
{areacode: "207", state: "Maine"},
|
||||
|
||||
{areacode: "208", state: "Idaho"},
|
||||
{areacode: "209", state: "California"},
|
||||
{areacode: "210", state: "Texas"},
|
||||
{areacode: "212", state: "New York"},
|
||||
{areacode: "213", state: "California"},
|
||||
{areacode: "214", state: "Texas"},
|
||||
|
||||
{areacode: "215", state: "Pennsylvania"},
|
||||
{areacode: "216", state: "Ohio"},
|
||||
{areacode: "217", state: "Illinois"},
|
||||
{areacode: "218", state: "Minnesota"},
|
||||
{areacode: "219", state: "Indiana"},
|
||||
{areacode: "224", state: "Illinois"},
|
||||
|
||||
{areacode: "225", state: "Louisiana"},
|
||||
{areacode: "227", state: "Maryland"},
|
||||
{areacode: "228", state: "Mississippi"},
|
||||
{areacode: "229", state: "Georgia"},
|
||||
{areacode: "231", state: "Michigan"},
|
||||
{areacode: "234", state: "Ohio"},
|
||||
|
||||
{areacode: "239", state: "Florida"},
|
||||
{areacode: "240", state: "Maryland"},
|
||||
{areacode: "242", state: "Bahamas"},
|
||||
{areacode: "246", state: "Barbados"},
|
||||
{areacode: "248", state: "Michigan"},
|
||||
{areacode: "250", state: "British Columbia"},
|
||||
|
||||
{areacode: "251", state: "Alabama"},
|
||||
{areacode: "252", state: "North Carolina"},
|
||||
{areacode: "253", state: "Washington"},
|
||||
{areacode: "254", state: "Texas"},
|
||||
{areacode: "256", state: "Alabama"},
|
||||
{areacode: "260", state: "Indiana"},
|
||||
|
||||
{areacode: "262", state: "Wisconsin"},
|
||||
{areacode: "264", state: "Anguilla"},
|
||||
{areacode: "267", state: "Pennsylvania"},
|
||||
{areacode: "268", state: "Antigua and Barbuda"},
|
||||
{areacode: "269", state: "Michigan"},
|
||||
{areacode: "270", state: "Kentucky"},
|
||||
|
||||
{areacode: "276", state: "Virginia"},
|
||||
{areacode: "281", state: "Texas"},
|
||||
{areacode: "283", state: "Ohio"},
|
||||
{areacode: "284", state: "British Virgin Islands"},
|
||||
{areacode: "289", state: "Ontario"},
|
||||
{areacode: "301", state: "Maryland"},
|
||||
|
||||
{areacode: "302", state: "Delaware"},
|
||||
{areacode: "303", state: "Colorado"},
|
||||
{areacode: "304", state: "West Virginia"},
|
||||
{areacode: "305", state: "Florida"},
|
||||
{areacode: "306", state: "Saskatchewan, Canada"},
|
||||
{areacode: "307", state: "Wyoming"},
|
||||
|
||||
{areacode: "308", state: "Nebraska"},
|
||||
{areacode: "309", state: "Illinois"},
|
||||
{areacode: "310", state: "California"},
|
||||
{areacode: "312", state: "Illinois"},
|
||||
{areacode: "313", state: "Michigan"},
|
||||
{areacode: "314", state: "Missouri"},
|
||||
|
||||
{areacode: "315", state: "New York"},
|
||||
{areacode: "316", state: "Kansas"},
|
||||
{areacode: "317", state: "Indiana"},
|
||||
{areacode: "318", state: "Louisiana"},
|
||||
{areacode: "319", state: "Iowa"},
|
||||
{areacode: "320", state: "Minnesota"},
|
||||
|
||||
{areacode: "321", state: "Florida"},
|
||||
{areacode: "323", state: "California"},
|
||||
{areacode: "330", state: "Ohio"},
|
||||
{areacode: "331", state: "Illinois"},
|
||||
{areacode: "334", state: "Alabama"},
|
||||
{areacode: "336", state: "North Carolina"},
|
||||
|
||||
{areacode: "337", state: "Louisiana"},
|
||||
{areacode: "339", state: "Massachusetts"},
|
||||
{areacode: "340", state: "US Virgin Islands"},
|
||||
{areacode: "345", state: "Cayman Islands"},
|
||||
{areacode: "347", state: "New York"},
|
||||
{areacode: "351", state: "Massachusetts"},
|
||||
|
||||
{areacode: "352", state: "Florida"},
|
||||
{areacode: "360", state: "Washington"},
|
||||
{areacode: "361", state: "Texas"},
|
||||
{areacode: "386", state: "Florida"},
|
||||
{areacode: "401", state: "Rhode Island"},
|
||||
{areacode: "402", state: "Nebraska"},
|
||||
|
||||
{areacode: "403", state: "Alberta, Canada"},
|
||||
{areacode: "404", state: "Georgia"},
|
||||
{areacode: "405", state: "Oklahoma"},
|
||||
{areacode: "406", state: "Montana"},
|
||||
{areacode: "407", state: "Florida"},
|
||||
{areacode: "408", state: "California"},
|
||||
|
||||
{areacode: "409", state: "Texas"},
|
||||
{areacode: "410", state: "Maryland"},
|
||||
{areacode: "412", state: "Pennsylvania"},
|
||||
{areacode: "413", state: "Massachusetts"},
|
||||
{areacode: "414", state: "Wisconsin"},
|
||||
{areacode: "415", state: "California"},
|
||||
|
||||
{areacode: "416", state: "Ontario, Canada"},
|
||||
{areacode: "417", state: "Missouri"},
|
||||
{areacode: "418", state: "Quebec, Canada"},
|
||||
{areacode: "419", state: "Ohio"},
|
||||
{areacode: "423", state: "Tennessee"},
|
||||
{areacode: "424", state: "California"},
|
||||
|
||||
{areacode: "425", state: "Washington"},
|
||||
{areacode: "434", state: "Virginia"},
|
||||
{areacode: "435", state: "Utah"},
|
||||
{areacode: "440", state: "Ohio"},
|
||||
{areacode: "441", state: "Bermuda"},
|
||||
{areacode: "443", state: "Maryland"},
|
||||
|
||||
{areacode: "445", state: "Pennsylvania"},
|
||||
{areacode: "450", state: "Quebec, Canada"},
|
||||
{areacode: "464", state: "Illinois"},
|
||||
{areacode: "469", state: "Texas"},
|
||||
{areacode: "470", state: "Georgia"},
|
||||
{areacode: "473", state: "Grenada"},
|
||||
|
||||
{areacode: "475", state: "Connecticut"},
|
||||
{areacode: "478", state: "Georgia"},
|
||||
{areacode: "479", state: "Arkansas"},
|
||||
{areacode: "480", state: "Arizona"},
|
||||
{areacode: "484", state: "Pennsylvania"},
|
||||
{areacode: "501", state: "Arkansas"},
|
||||
|
||||
{areacode: "502", state: "Kentucky"},
|
||||
{areacode: "503", state: "Oregon"},
|
||||
{areacode: "504", state: "Louisiana"},
|
||||
{areacode: "505", state: "New Mexico"},
|
||||
{areacode: "506", state: "New Brunswick, Canada"},
|
||||
{areacode: "507", state: "Minnesota"},
|
||||
|
||||
{areacode: "508", state: "Massachusetts"},
|
||||
{areacode: "509", state: "Washington"},
|
||||
{areacode: "510", state: "California"},
|
||||
{areacode: "512", state: "Texas"},
|
||||
{areacode: "513", state: "Ohio"},
|
||||
{areacode: "514", state: "Quebec, Canada"},
|
||||
|
||||
{areacode: "515", state: "Iowa"},
|
||||
{areacode: "516", state: "New York"},
|
||||
{areacode: "517", state: "Michigan"},
|
||||
{areacode: "518", state: "New York"},
|
||||
{areacode: "519", state: "Ontario, Canada"},
|
||||
{areacode: "520", state: "Arizona"},
|
||||
|
||||
{areacode: "530", state: "California"},
|
||||
{areacode: "540", state: "Virginia"},
|
||||
{areacode: "541", state: "Oregon"},
|
||||
{areacode: "551", state: "New Jersey"},
|
||||
{areacode: "557", state: "Missouri"},
|
||||
{areacode: "559", state: "California"},
|
||||
|
||||
{areacode: "561", state: "Florida"},
|
||||
{areacode: "562", state: "California"},
|
||||
{areacode: "563", state: "Iowa"},
|
||||
{areacode: "564", state: "Washington"},
|
||||
{areacode: "567", state: "Ohio"},
|
||||
{areacode: "570", state: "Pennsylvania"},
|
||||
|
||||
{areacode: "571", state: "Virginia"},
|
||||
{areacode: "573", state: "Missouri"},
|
||||
{areacode: "574", state: "Indiana"},
|
||||
{areacode: "580", state: "Oklahoma"},
|
||||
{areacode: "585", state: "New York"},
|
||||
{areacode: "586", state: "Michigan"},
|
||||
|
||||
{areacode: "601", state: "Mississippi"},
|
||||
{areacode: "602", state: "Arizona"},
|
||||
{areacode: "603", state: "New Hampshire"},
|
||||
{areacode: "604", state: "British Columbia, Canada"},
|
||||
{areacode: "605", state: "South Dakota"},
|
||||
{areacode: "606", state: "Kentucky"},
|
||||
|
||||
{areacode: "607", state: "New York"},
|
||||
{areacode: "608", state: "Wisconsin"},
|
||||
{areacode: "609", state: "New Jersey"},
|
||||
{areacode: "610", state: "Pennsylvania"},
|
||||
{areacode: "612", state: "Minnesota"},
|
||||
{areacode: "613", state: "Ontario, Canada"},
|
||||
|
||||
{areacode: "614", state: "Ohio"},
|
||||
{areacode: "615", state: "Tennessee"},
|
||||
{areacode: "616", state: "Michigan"},
|
||||
{areacode: "617", state: "Massachusetts"},
|
||||
{areacode: "618", state: "Illinois"},
|
||||
{areacode: "619", state: "California"},
|
||||
|
||||
{areacode: "620", state: "Kansas"},
|
||||
{areacode: "623", state: "Arizona"},
|
||||
{areacode: "626", state: "California"},
|
||||
{areacode: "630", state: "Illinois"},
|
||||
{areacode: "631", state: "New York"},
|
||||
{areacode: "636", state: "Missouri"},
|
||||
|
||||
{areacode: "641", state: "Iowa"},
|
||||
{areacode: "646", state: "New York"},
|
||||
{areacode: "647", state: "Ontario, Canada"},
|
||||
{areacode: "649", state: "Turks and Caicos Islands"},
|
||||
{areacode: "650", state: "California"},
|
||||
{areacode: "651", state: "Minnesota"},
|
||||
|
||||
{areacode: "660", state: "Missouri"},
|
||||
{areacode: "661", state: "California"},
|
||||
{areacode: "662", state: "Mississippi"},
|
||||
{areacode: "664", state: "Montserrat"},
|
||||
{areacode: "667", state: "Maryland"},
|
||||
{areacode: "670", state: "CNMI"},
|
||||
|
||||
{areacode: "671", state: "Guam"},
|
||||
{areacode: "678", state: "Georgia"},
|
||||
{areacode: "682", state: "Texas"},
|
||||
{areacode: "701", state: "North Dakota"},
|
||||
{areacode: "702", state: "Nevada"},
|
||||
{areacode: "703", state: "Virginia"},
|
||||
|
||||
{areacode: "704", state: "North Carolina"},
|
||||
{areacode: "705", state: "Ontario, Canada"},
|
||||
{areacode: "706", state: "Georgia"},
|
||||
{areacode: "707", state: "California"},
|
||||
{areacode: "708", state: "Illinois"},
|
||||
{areacode: "709", state: "Newfoundland, Canada"},
|
||||
|
||||
{areacode: "712", state: "Iowa"},
|
||||
{areacode: "713", state: "Texas"},
|
||||
{areacode: "714", state: "California"},
|
||||
{areacode: "715", state: "Wisconsin"},
|
||||
{areacode: "716", state: "New York"},
|
||||
{areacode: "717", state: "Pennsylvania"},
|
||||
|
||||
{areacode: "718", state: "New York"},
|
||||
{areacode: "719", state: "Colorado"},
|
||||
{areacode: "720", state: "Colorado"},
|
||||
{areacode: "724", state: "Pennsylvania"},
|
||||
{areacode: "727", state: "Florida"},
|
||||
{areacode: "731", state: "Tennessee"},
|
||||
|
||||
{areacode: "732", state: "New Jersey"},
|
||||
{areacode: "734", state: "Michigan"},
|
||||
{areacode: "737", state: "Texas"},
|
||||
{areacode: "740", state: "Ohio"},
|
||||
{areacode: "754", state: "Florida"},
|
||||
{areacode: "757", state: "Viriginia"},
|
||||
|
||||
{areacode: "758", state: "St. Lucia"},
|
||||
{areacode: "760", state: "California"},
|
||||
{areacode: "763", state: "Minnesota"},
|
||||
{areacode: "765", state: "Indiana"},
|
||||
{areacode: "767", state: "Dominica"},
|
||||
{areacode: "770", state: "Georgia"},
|
||||
|
||||
{areacode: "772", state: "Florida"},
|
||||
{areacode: "773", state: "Illinois"},
|
||||
{areacode: "774", state: "Massachusetts"},
|
||||
{areacode: "775", state: "Nevada"},
|
||||
{areacode: "778", state: "British Columbia, Canada"},
|
||||
{areacode: "780", state: "Alberta, Canada"},
|
||||
|
||||
{areacode: "781", state: "Massachusetts"},
|
||||
{areacode: "784", state: "St. Vincent & Gren."},
|
||||
{areacode: "785", state: "Kansas"},
|
||||
{areacode: "786", state: "Florida"},
|
||||
{areacode: "787", state: "Puerto Rico"},
|
||||
|
||||
{areacode: "801", state: "Utah"},
|
||||
{areacode: "802", state: "Vermont"},
|
||||
{areacode: "803", state: "South Carolina"},
|
||||
{areacode: "804", state: "Virginia"},
|
||||
{areacode: "805", state: "California"},
|
||||
{areacode: "806", state: "Texas"},
|
||||
|
||||
{areacode: "807", state: "Ontario, Canada"},
|
||||
{areacode: "808", state: "Hawaii"},
|
||||
{areacode: "809", state: "Dominican Republic"},
|
||||
{areacode: "810", state: "Michigan"},
|
||||
{areacode: "812", state: "Indiana"},
|
||||
{areacode: "813", state: "Florida"},
|
||||
|
||||
{areacode: "814", state: "Pennsylvania"},
|
||||
{areacode: "815", state: "Illinois"},
|
||||
{areacode: "816", state: "Missouri"},
|
||||
{areacode: "817", state: "Texas"},
|
||||
{areacode: "818", state: "California"},
|
||||
{areacode: "819", state: "Quebec, Canada"},
|
||||
|
||||
{areacode: "828", state: "North Carolina"},
|
||||
{areacode: "830", state: "Texas"},
|
||||
{areacode: "831", state: "California"},
|
||||
{areacode: "832", state: "Texas"},
|
||||
{areacode: "835", state: "Pennsylvania"},
|
||||
{areacode: "843", state: "South Carolina"},
|
||||
|
||||
{areacode: "845", state: "New York"},
|
||||
{areacode: "847", state: "Illinois"},
|
||||
{areacode: "848", state: "New Jersey"},
|
||||
{areacode: "850", state: "Florida"},
|
||||
{areacode: "856", state: "New Jersey"},
|
||||
{areacode: "857", state: "Massachusetts"},
|
||||
|
||||
{areacode: "858", state: "California"},
|
||||
{areacode: "859", state: "Kentucky"},
|
||||
{areacode: "860", state: "Connecticut"},
|
||||
{areacode: "862", state: "New Jersey"},
|
||||
{areacode: "863", state: "Florida"},
|
||||
{areacode: "864", state: "South Carolina"},
|
||||
|
||||
{areacode: "865", state: "Tennessee"},
|
||||
{areacode: "867", state: "Yukon, NW Territories, Canada"},
|
||||
{areacode: "868", state: "Trinidad and Tobago"},
|
||||
{areacode: "869", state: "St. Kitts & Nevis"},
|
||||
{areacode: "870", state: "Arkansas"},
|
||||
|
||||
{areacode: "872", state: "Illinois"},
|
||||
{areacode: "876", state: "Jamaica"},
|
||||
{areacode: "878", state: "Pennsylvania"},
|
||||
{areacode: "901", state: "Tennessee"},
|
||||
{areacode: "902", state: "Nova Scotia, Canada"},
|
||||
{areacode: "903", state: "Texas"},
|
||||
|
||||
{areacode: "904", state: "Florida"},
|
||||
{areacode: "905", state: "Ontario, Canada"},
|
||||
{areacode: "906", state: "Michigan"},
|
||||
{areacode: "907", state: "Alaska"},
|
||||
{areacode: "908", state: "New Jersey"},
|
||||
{areacode: "909", state: "California"},
|
||||
|
||||
{areacode: "910", state: "North Carolina"},
|
||||
{areacode: "912", state: "Georgia"},
|
||||
{areacode: "913", state: "Kansas"},
|
||||
{areacode: "914", state: "New York"},
|
||||
{areacode: "915", state: "Texas"},
|
||||
{areacode: "916", state: "California"},
|
||||
|
||||
{areacode: "917", state: "New York"},
|
||||
{areacode: "918", state: "Oklahoma"},
|
||||
{areacode: "919", state: "North Carolina"},
|
||||
{areacode: "920", state: "Wisconsin"},
|
||||
{areacode: "925", state: "California"},
|
||||
{areacode: "928", state: "Arizona"},
|
||||
|
||||
{areacode: "931", state: "Tennessee"},
|
||||
{areacode: "936", state: "Texas"},
|
||||
{areacode: "937", state: "Ohio"},
|
||||
{areacode: "939", state: "Puerto Rico"},
|
||||
{areacode: "940", state: "Texas"},
|
||||
{areacode: "941", state: "Florida"},
|
||||
|
||||
{areacode: "947", state: "Michigan"},
|
||||
{areacode: "949", state: "California"},
|
||||
{areacode: "952", state: "Minnesota"},
|
||||
{areacode: "954", state: "Florida"},
|
||||
{areacode: "956", state: "Texas"},
|
||||
{areacode: "959", state: "Connecticut"},
|
||||
|
||||
{areacode: "970", state: "Colorado"},
|
||||
{areacode: "971", state: "Oregon"},
|
||||
{areacode: "972", state: "Texas"},
|
||||
{areacode: "973", state: "New Jersey"},
|
||||
{areacode: "975", state: "Missouri"},
|
||||
{areacode: "978", state: "Massachusetts"},
|
||||
|
||||
{areacode: "979", state: "Texas"},
|
||||
{areacode: "980", state: "North Carolina"},
|
||||
{areacode: "984", state: "North Carolina"},
|
||||
{areacode: "985", state: "Louisiana"},
|
||||
{areacode: "989", state: "Michigan"}
|
||||
]
|
||||
};
|
||||
|
|
@ -1,808 +0,0 @@
|
|||
<?php
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
|
||||
|
||||
/* yadl_spaceid - Skip Stamping */
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* JSON (JavaScript Object Notation) is a lightweight data-interchange
|
||||
* format. It is easy for humans to read and write. It is easy for machines
|
||||
* to parse and generate. It is based on a subset of the JavaScript
|
||||
* Programming Language, Standard ECMA-262 3rd Edition - December 1999.
|
||||
* This feature can also be found in Python. JSON is a text format that is
|
||||
* completely language independent but uses conventions that are familiar
|
||||
* to programmers of the C-family of languages, including C, C++, C#, Java,
|
||||
* JavaScript, Perl, TCL, and many others. These properties make JSON an
|
||||
* ideal data-interchange language.
|
||||
*
|
||||
* This package provides a simple encoder and decoder for JSON notation. It
|
||||
* is intended for use with client-side Javascript applications that make
|
||||
* use of HTTPRequest to perform server communication functions - data can
|
||||
* be encoded into JSON notation for use in a client-side javascript, or
|
||||
* decoded from incoming Javascript requests. JSON format is native to
|
||||
* Javascript, and can be directly eval()'ed with no further parsing
|
||||
* overhead
|
||||
*
|
||||
* All strings should be in ASCII or UTF-8 format!
|
||||
*
|
||||
* LICENSE: Redistribution and use in source and binary forms, with or
|
||||
* without modification, are permitted provided that the following
|
||||
* conditions are met: Redistributions of source code must retain the
|
||||
* above copyright notice, this list of conditions and the following
|
||||
* disclaimer. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
||||
* NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
* DAMAGE.
|
||||
*
|
||||
* @category
|
||||
* @package Services_JSON
|
||||
* @author Michal Migurski <mike-json@teczno.com>
|
||||
* @author Matt Knapp <mdknapp[at]gmail[dot]com>
|
||||
* @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
|
||||
* @copyright 2005 Michal Migurski
|
||||
* @version CVS: $Id: JSON.php,v 1.2 2007/07/31 21:14:29 jennyhan Exp $
|
||||
* @license http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
|
||||
*/
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_SLICE', 1);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_STR', 2);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_ARR', 3);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_OBJ', 4);
|
||||
|
||||
/**
|
||||
* Marker constant for Services_JSON::decode(), used to flag stack state
|
||||
*/
|
||||
define('SERVICES_JSON_IN_CMT', 5);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_LOOSE_TYPE', 16);
|
||||
|
||||
/**
|
||||
* Behavior switch for Services_JSON::decode()
|
||||
*/
|
||||
define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
|
||||
|
||||
/**
|
||||
* Converts to and from JSON format.
|
||||
*
|
||||
* Brief example of use:
|
||||
*
|
||||
* <code>
|
||||
* // create a new instance of Services_JSON
|
||||
* $json = new Services_JSON();
|
||||
*
|
||||
* // convert a complexe value to JSON notation, and send it to the browser
|
||||
* $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
|
||||
* $output = $json->encode($value);
|
||||
*
|
||||
* print($output);
|
||||
* // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
|
||||
*
|
||||
* // accept incoming POST data, assumed to be in JSON notation
|
||||
* $input = file_get_contents('php://input', 1000000);
|
||||
* $value = $json->decode($input);
|
||||
* </code>
|
||||
*/
|
||||
class Services_JSON
|
||||
{
|
||||
/**
|
||||
* constructs a new JSON instance
|
||||
*
|
||||
* @param int $use object behavior flags; combine with boolean-OR
|
||||
*
|
||||
* possible values:
|
||||
* - SERVICES_JSON_LOOSE_TYPE: loose typing.
|
||||
* "{...}" syntax creates associative arrays
|
||||
* instead of objects in decode().
|
||||
* - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
|
||||
* Values which can't be encoded (e.g. resources)
|
||||
* appear as NULL instead of throwing errors.
|
||||
* By default, a deeply-nested resource will
|
||||
* bubble up with an error, so all return values
|
||||
* from encode() should be checked with isError()
|
||||
*/
|
||||
function Services_JSON($use = 0)
|
||||
{
|
||||
$this->use = $use;
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-16 char to one UTF-8 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf16 UTF-16 character
|
||||
* @return string UTF-8 character
|
||||
* @access private
|
||||
*/
|
||||
function utf162utf8($utf16)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
|
||||
}
|
||||
|
||||
$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
|
||||
|
||||
switch(true) {
|
||||
case ((0x7F & $bytes) == $bytes):
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x7F & $bytes);
|
||||
|
||||
case (0x07FF & $bytes) == $bytes:
|
||||
// return a 2-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xC0 | (($bytes >> 6) & 0x1F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
|
||||
case (0xFFFF & $bytes) == $bytes:
|
||||
// return a 3-byte UTF-8 character
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0xE0 | (($bytes >> 12) & 0x0F))
|
||||
. chr(0x80 | (($bytes >> 6) & 0x3F))
|
||||
. chr(0x80 | ($bytes & 0x3F));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* convert a string from one UTF-8 char to one UTF-16 char
|
||||
*
|
||||
* Normally should be handled by mb_convert_encoding, but
|
||||
* provides a slower PHP-only method for installations
|
||||
* that lack the multibye string extension.
|
||||
*
|
||||
* @param string $utf8 UTF-8 character
|
||||
* @return string UTF-16 character
|
||||
* @access private
|
||||
*/
|
||||
function utf82utf16($utf8)
|
||||
{
|
||||
// oh please oh please oh please oh please oh please
|
||||
if(function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
}
|
||||
|
||||
switch(strlen($utf8)) {
|
||||
case 1:
|
||||
// this case should never be reached, because we are in ASCII range
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
// return a UTF-16 character from a 2-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr(0x07 & (ord($utf8{0}) >> 2))
|
||||
. chr((0xC0 & (ord($utf8{0}) << 6))
|
||||
| (0x3F & ord($utf8{1})));
|
||||
|
||||
case 3:
|
||||
// return a UTF-16 character from a 3-byte UTF-8 char
|
||||
// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
return chr((0xF0 & (ord($utf8{0}) << 4))
|
||||
| (0x0F & (ord($utf8{1}) >> 2)))
|
||||
. chr((0xC0 & (ord($utf8{1}) << 6))
|
||||
| (0x7F & ord($utf8{2})));
|
||||
}
|
||||
|
||||
// ignoring UTF-32 for now, sorry
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* encodes an arbitrary variable into JSON format
|
||||
*
|
||||
* @param mixed $var any number, boolean, string, array, or object to be encoded.
|
||||
* see argument 1 to Services_JSON() above for array-parsing behavior.
|
||||
* if var is a strng, note that encode() always expects it
|
||||
* to be in ASCII or UTF-8 format!
|
||||
*
|
||||
* @return mixed JSON string representation of input var or an error if a problem occurs
|
||||
* @access public
|
||||
*/
|
||||
function encode($var)
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'boolean':
|
||||
return $var ? 'true' : 'false';
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'integer':
|
||||
return (int) $var;
|
||||
|
||||
case 'double':
|
||||
case 'float':
|
||||
return (float) $var;
|
||||
|
||||
case 'string':
|
||||
// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
|
||||
$ascii = '';
|
||||
$strlen_var = strlen($var);
|
||||
|
||||
/*
|
||||
* Iterate over every character in the string,
|
||||
* escaping with a slash or encoding to UTF-8 where necessary
|
||||
*/
|
||||
for ($c = 0; $c < $strlen_var; ++$c) {
|
||||
|
||||
$ord_var_c = ord($var{$c});
|
||||
|
||||
switch (true) {
|
||||
case $ord_var_c == 0x08:
|
||||
$ascii .= '\b';
|
||||
break;
|
||||
case $ord_var_c == 0x09:
|
||||
$ascii .= '\t';
|
||||
break;
|
||||
case $ord_var_c == 0x0A:
|
||||
$ascii .= '\n';
|
||||
break;
|
||||
case $ord_var_c == 0x0C:
|
||||
$ascii .= '\f';
|
||||
break;
|
||||
case $ord_var_c == 0x0D:
|
||||
$ascii .= '\r';
|
||||
break;
|
||||
|
||||
case $ord_var_c == 0x22:
|
||||
case $ord_var_c == 0x2F:
|
||||
case $ord_var_c == 0x5C:
|
||||
// double quote, slash, slosh
|
||||
$ascii .= '\\'.$var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
|
||||
// characters U-00000000 - U-0000007F (same as ASCII)
|
||||
$ascii .= $var{$c};
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xE0) == 0xC0):
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
|
||||
$c += 1;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF0) == 0xE0):
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}));
|
||||
$c += 2;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xF8) == 0xF0):
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}));
|
||||
$c += 3;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFC) == 0xF8):
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}));
|
||||
$c += 4;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
|
||||
case (($ord_var_c & 0xFE) == 0xFC):
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$char = pack('C*', $ord_var_c,
|
||||
ord($var{$c + 1}),
|
||||
ord($var{$c + 2}),
|
||||
ord($var{$c + 3}),
|
||||
ord($var{$c + 4}),
|
||||
ord($var{$c + 5}));
|
||||
$c += 5;
|
||||
$utf16 = $this->utf82utf16($char);
|
||||
$ascii .= sprintf('\u%04s', bin2hex($utf16));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return '"'.$ascii.'"';
|
||||
|
||||
case 'array':
|
||||
/*
|
||||
* As per JSON spec if any array key is not an integer
|
||||
* we must treat the the whole array as an object. We
|
||||
* also try to catch a sparsely populated associative
|
||||
* array with numeric keys here because some JS engines
|
||||
* will create an array with empty indexes up to
|
||||
* max_index which can cause memory issues and because
|
||||
* the keys, which may be relevant, will be remapped
|
||||
* otherwise.
|
||||
*
|
||||
* As per the ECMA and JSON specification an object may
|
||||
* have any string as a property. Unfortunately due to
|
||||
* a hole in the ECMA specification if the key is a
|
||||
* ECMA reserved word or starts with a digit the
|
||||
* parameter is only accessible using ECMAScript's
|
||||
* bracket notation.
|
||||
*/
|
||||
|
||||
// treat as a JSON object
|
||||
if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($var),
|
||||
array_values($var));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
}
|
||||
|
||||
// treat it like a regular array
|
||||
$elements = array_map(array($this, 'encode'), $var);
|
||||
|
||||
foreach($elements as $element) {
|
||||
if(Services_JSON::isError($element)) {
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
return '[' . join(',', $elements) . ']';
|
||||
|
||||
case 'object':
|
||||
$vars = get_object_vars($var);
|
||||
|
||||
$properties = array_map(array($this, 'name_value'),
|
||||
array_keys($vars),
|
||||
array_values($vars));
|
||||
|
||||
foreach($properties as $property) {
|
||||
if(Services_JSON::isError($property)) {
|
||||
return $property;
|
||||
}
|
||||
}
|
||||
|
||||
return '{' . join(',', $properties) . '}';
|
||||
|
||||
default:
|
||||
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
|
||||
? 'null'
|
||||
: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* array-walking function for use in generating JSON-formatted name-value pairs
|
||||
*
|
||||
* @param string $name name of key to use
|
||||
* @param mixed $value reference to an array element to be encoded
|
||||
*
|
||||
* @return string JSON-formatted name-value pair, like '"name":value'
|
||||
* @access private
|
||||
*/
|
||||
function name_value($name, $value)
|
||||
{
|
||||
$encoded_value = $this->encode($value);
|
||||
|
||||
if(Services_JSON::isError($encoded_value)) {
|
||||
return $encoded_value;
|
||||
}
|
||||
|
||||
return $this->encode(strval($name)) . ':' . $encoded_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* reduce a string by removing leading and trailing comments and whitespace
|
||||
*
|
||||
* @param $str string string value to strip of comments and whitespace
|
||||
*
|
||||
* @return string string value stripped of comments and whitespace
|
||||
* @access private
|
||||
*/
|
||||
function reduce_string($str)
|
||||
{
|
||||
$str = preg_replace(array(
|
||||
|
||||
// eliminate single line comments in '// ...' form
|
||||
'#^\s*//(.+)$#m',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at start of string
|
||||
'#^\s*/\*(.+)\*/#Us',
|
||||
|
||||
// eliminate multi-line comments in '/* ... */' form, at end of string
|
||||
'#/\*(.+)\*/\s*$#Us'
|
||||
|
||||
), '', $str);
|
||||
|
||||
// eliminate extraneous space
|
||||
return trim($str);
|
||||
}
|
||||
|
||||
/**
|
||||
* decodes a JSON string into appropriate variable
|
||||
*
|
||||
* @param string $str JSON-formatted string
|
||||
*
|
||||
* @return mixed number, boolean, string, array, or object
|
||||
* corresponding to given JSON input string.
|
||||
* See argument 1 to Services_JSON() above for object-output behavior.
|
||||
* Note that decode() always returns strings
|
||||
* in ASCII or UTF-8 format!
|
||||
* @access public
|
||||
*/
|
||||
function decode($str)
|
||||
{
|
||||
$str = $this->reduce_string($str);
|
||||
|
||||
switch (strtolower($str)) {
|
||||
case 'true':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
return false;
|
||||
|
||||
case 'null':
|
||||
return null;
|
||||
|
||||
default:
|
||||
$m = array();
|
||||
|
||||
if (is_numeric($str)) {
|
||||
// Lookie-loo, it's a number
|
||||
|
||||
// This would work on its own, but I'm trying to be
|
||||
// good about returning integers where appropriate:
|
||||
// return (float)$str;
|
||||
|
||||
// Return float or int, as appropriate
|
||||
return ((float)$str == (integer)$str)
|
||||
? (integer)$str
|
||||
: (float)$str;
|
||||
|
||||
} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
|
||||
// STRINGS RETURNED IN UTF-8 FORMAT
|
||||
$delim = substr($str, 0, 1);
|
||||
$chrs = substr($str, 1, -1);
|
||||
$utf8 = '';
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c < $strlen_chrs; ++$c) {
|
||||
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
$ord_chrs_c = ord($chrs{$c});
|
||||
|
||||
switch (true) {
|
||||
case $substr_chrs_c_2 == '\b':
|
||||
$utf8 .= chr(0x08);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\t':
|
||||
$utf8 .= chr(0x09);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\n':
|
||||
$utf8 .= chr(0x0A);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\f':
|
||||
$utf8 .= chr(0x0C);
|
||||
++$c;
|
||||
break;
|
||||
case $substr_chrs_c_2 == '\r':
|
||||
$utf8 .= chr(0x0D);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case $substr_chrs_c_2 == '\\"':
|
||||
case $substr_chrs_c_2 == '\\\'':
|
||||
case $substr_chrs_c_2 == '\\\\':
|
||||
case $substr_chrs_c_2 == '\\/':
|
||||
if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
|
||||
($delim == "'" && $substr_chrs_c_2 != '\\"')) {
|
||||
$utf8 .= $chrs{++$c};
|
||||
}
|
||||
break;
|
||||
|
||||
case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
|
||||
// single, escaped unicode character
|
||||
$utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
|
||||
. chr(hexdec(substr($chrs, ($c + 4), 2)));
|
||||
$utf8 .= $this->utf162utf8($utf16);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
|
||||
$utf8 .= $chrs{$c};
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xE0) == 0xC0:
|
||||
// characters U-00000080 - U-000007FF, mask 110XXXXX
|
||||
//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 2);
|
||||
++$c;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF0) == 0xE0:
|
||||
// characters U-00000800 - U-0000FFFF, mask 1110XXXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 3);
|
||||
$c += 2;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xF8) == 0xF0:
|
||||
// characters U-00010000 - U-001FFFFF, mask 11110XXX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 4);
|
||||
$c += 3;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFC) == 0xF8:
|
||||
// characters U-00200000 - U-03FFFFFF, mask 111110XX
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 5);
|
||||
$c += 4;
|
||||
break;
|
||||
|
||||
case ($ord_chrs_c & 0xFE) == 0xFC:
|
||||
// characters U-04000000 - U-7FFFFFFF, mask 1111110X
|
||||
// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
|
||||
$utf8 .= substr($chrs, $c, 6);
|
||||
$c += 5;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $utf8;
|
||||
|
||||
} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
|
||||
// array, or object notation
|
||||
|
||||
if ($str{0} == '[') {
|
||||
$stk = array(SERVICES_JSON_IN_ARR);
|
||||
$arr = array();
|
||||
} else {
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = array();
|
||||
} else {
|
||||
$stk = array(SERVICES_JSON_IN_OBJ);
|
||||
$obj = new stdClass();
|
||||
}
|
||||
}
|
||||
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE,
|
||||
'where' => 0,
|
||||
'delim' => false));
|
||||
|
||||
$chrs = substr($str, 1, -1);
|
||||
$chrs = $this->reduce_string($chrs);
|
||||
|
||||
if ($chrs == '') {
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} else {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//print("\nparsing {$chrs}\n");
|
||||
|
||||
$strlen_chrs = strlen($chrs);
|
||||
|
||||
for ($c = 0; $c <= $strlen_chrs; ++$c) {
|
||||
|
||||
$top = end($stk);
|
||||
$substr_chrs_c_2 = substr($chrs, $c, 2);
|
||||
|
||||
if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
|
||||
// found a comma that is not inside a string, array, etc.,
|
||||
// OR we've reached the end of the character list
|
||||
$slice = substr($chrs, $top['where'], ($c - $top['where']));
|
||||
array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
|
||||
//print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
// we are in an array, so just push an element onto the stack
|
||||
array_push($arr, $this->decode($slice));
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
// we are in an object, so figure
|
||||
// out the property name and set an
|
||||
// element in an associative array,
|
||||
// for now
|
||||
$parts = array();
|
||||
|
||||
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// "name":value pair
|
||||
$key = $this->decode($parts[1]);
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
} elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
|
||||
// name:value pair, where name is unquoted
|
||||
$key = $parts[1];
|
||||
$val = $this->decode($parts[2]);
|
||||
|
||||
if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
|
||||
$obj[$key] = $val;
|
||||
} else {
|
||||
$obj->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
|
||||
// found a quote, and we are not inside a string
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
|
||||
//print("Found start of string at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == $top['delim']) &&
|
||||
($top['what'] == SERVICES_JSON_IN_STR) &&
|
||||
((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
|
||||
// found a quote, we're in a string, and it's not escaped
|
||||
// we know that it's not escaped becase there is _not_ an
|
||||
// odd number of backslashes at the end of the string so far
|
||||
array_pop($stk);
|
||||
//print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '[') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-bracket, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of array at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
|
||||
// found a right-bracket, and we're in an array
|
||||
array_pop($stk);
|
||||
//print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($chrs{$c} == '{') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a left-brace, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
|
||||
//print("Found start of object at {$c}\n");
|
||||
|
||||
} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
|
||||
// found a right-brace, and we're in an object
|
||||
array_pop($stk);
|
||||
//print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '/*') &&
|
||||
in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
|
||||
// found a comment start, and we are in an array, object, or slice
|
||||
array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
|
||||
$c++;
|
||||
//print("Found start of comment at {$c}\n");
|
||||
|
||||
} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
|
||||
// found a comment end, and we're in one now
|
||||
array_pop($stk);
|
||||
$c++;
|
||||
|
||||
for ($i = $top['where']; $i <= $c; ++$i)
|
||||
$chrs = substr_replace($chrs, ' ', $i, 1);
|
||||
|
||||
//print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reset($stk) == SERVICES_JSON_IN_ARR) {
|
||||
return $arr;
|
||||
|
||||
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
|
||||
return $obj;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this should just call PEAR::isError()
|
||||
*/
|
||||
function isError($data, $code = null)
|
||||
{
|
||||
if (class_exists('pear')) {
|
||||
return PEAR::isError($data, $code);
|
||||
} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
|
||||
is_subclass_of($data, 'services_json_error'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('PEAR_Error')) {
|
||||
|
||||
class Services_JSON_Error extends PEAR_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/**
|
||||
* @todo Ultimately, this class shall be descended from PEAR_Error
|
||||
*/
|
||||
class Services_JSON_Error
|
||||
{
|
||||
function Services_JSON_Error($message = 'unknown error', $code = null,
|
||||
$mode = null, $options = null, $userinfo = null)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,10 +0,0 @@
|
|||
Domino's Pizza|615 Caliente Dr|Sunnyvale|(408) 732-3030|4|http://local.yahoo.com/details?id=21335892&stx=pizza&csz=Sunnyvale+CA&ed=17rS8q160Sy5Htog0TF1m1atNv01Iz7ySeGEMtCL4dJsf1ku0nhziD2qN5XcnHlJtDS4IydIbA--
|
||||
Pizza Depot|919 E Duane Ave|Sunnyvale|(408) 245-7760|3.5|http://local.yahoo.com/details?id=21332021&stx=pizza&csz=Sunnyvale+CA&ed=6tiAL6160Sx1XVIEu1zIWPu6fD8rJDV4.offJLNUTb1Ri2Q.R5oLTYvDCz8YmzivI7Bz0gfrpw--
|
||||
Pizza Hut|464 N Mathilda Ave|Sunnyvale|(408) 735-1900|2.5|http://local.yahoo.com/details?id=21340811&stx=pizza&csz=Sunnyvale+CA&ed=syVWvq160Szz0Q60Q8N7uetWGoUIbThLIdulmQLubJ29CuU7wpxDvDxrLF4md791a4jW7kNRr9eSVQ--
|
||||
Giovannis Pizzeria|1127 N Lawrence Expy|Sunnyvale|(408) 734-4221|4.5|http://local.yahoo.com/details?id=21341983&stx=pizza&csz=Sunnyvale+CA&ed=kYc.Ba160SxZddWADEWWMRsGo0KgZ6X22_QAgTZxq3OdfrVCfCdLU9mvvJeybt8XpDhMC58HjElJAiWi
|
||||
Round Table Pizza|415 N Mary Ave|Sunnyvale|(408) 733-1365|5|http://local.yahoo.com/details?id=21329046&stx=pizza&csz=Sunnyvale+CA&ed=OkhHFa160Sx2UXqpaqXDZAGyyKWrCO9wfqP24Mur1nNB2pqgQsi3DQxeSEK_Uj9fxQN4zNax
|
||||
Vitos Famous Pizza|1155 Reed Ave|Sunnyvale|(408) 246-8800|4.5|http://local.yahoo.com/details?id=21332026&stx=pizza&csz=Sunnyvale+CA&ed=QTqeMK160Sx0Mril0Jnu_RK0RF4vTvEspLb2s60hJTic2.RapYE82B6edOm18LAox7KOqkw-
|
||||
Round Table Pizza|101 Town And Countr|Sunnyvale|(408) 736-2242|3|http://local.yahoo.com/details?id=21340803&stx=pizza&csz=Sunnyvale+CA&ed=SiKr2K160SwJxDEvf_eAwROvFMpfCIqsVX3dSyYtvj6HomUPpdS92g9AIoaoZNtg.WNSGcT4hpk1JxxT
|
||||
Round Table Pizza|860 Old San Francisco Rd|Sunnyvale|(408) 245-9000|3|http://local.yahoo.com/details?id=21340791&stx=pizza&csz=Sunnyvale+CA&ed=NF3MAq160SzKHt2S1yk7tJKtIMvbW44yNlckp8Y5veL7w8DWvagJYLH2tGehl1cPcLGbR4kzMTi4cf1U7iP6YA--
|
||||
Domino's Pizza|992 W El Camino Real|Sunnyvale|(408) 736-3666|4|http://local.yahoo.com/details?id=21341882&stx=pizza&csz=Sunnyvale+CA&ed=_tzLZq160SyF.4GddMA07QiACQkYc84nqI0j3hvsAcfMemwlBCiezUltSm8_ppCH1Bo8SlklBj1QhuRp
|
||||
Little Caesars Pizza|1039 Sunnyvale Saratoga Rd|Sunnyvale|(408) 245-0607|3|http://local.yahoo.com/details?id=21330174&stx=pizza&csz=Sunnyvale+CA&ed=89myuK160Syd6uoWQ5fTb6uLid70P.ucvPaBKA92m7bc1aVSW5LGmRbGsSIqT8U5e2eA4Ki4nQHVAAhh5.SVNIAQ
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
Restaurant|Location|Town|Telephone|Stars|Website
|
||||
Domino's Pizza|615 Caliente Dr|Sunnyvale|(408) 732-3030|4|http://local.yahoo.com/details?id=21335892&stx=pizza&csz=Sunnyvale+CA&ed=17rS8q160Sy5Htog0TF1m1atNv01Iz7ySeGEMtCL4dJsf1ku0nhziD2qN5XcnHlJtDS4IydIbA--
|
||||
Pizza Depot|919 E Duane Ave|Sunnyvale|(408) 245-7760|3.5|http://local.yahoo.com/details?id=21332021&stx=pizza&csz=Sunnyvale+CA&ed=6tiAL6160Sx1XVIEu1zIWPu6fD8rJDV4.offJLNUTb1Ri2Q.R5oLTYvDCz8YmzivI7Bz0gfrpw--
|
||||
Pizza Hut|464 N Mathilda Ave|Sunnyvale|(408) 735-1900|2.5|http://local.yahoo.com/details?id=21340811&stx=pizza&csz=Sunnyvale+CA&ed=syVWvq160Szz0Q60Q8N7uetWGoUIbThLIdulmQLubJ29CuU7wpxDvDxrLF4md791a4jW7kNRr9eSVQ--
|
||||
Giovannis Pizzeria|1127 N Lawrence Expy|Sunnyvale|(408) 734-4221|4.5|http://local.yahoo.com/details?id=21341983&stx=pizza&csz=Sunnyvale+CA&ed=kYc.Ba160SxZddWADEWWMRsGo0KgZ6X22_QAgTZxq3OdfrVCfCdLU9mvvJeybt8XpDhMC58HjElJAiWi
|
||||
Round Table Pizza|415 N Mary Ave|Sunnyvale|(408) 733-1365|5|http://local.yahoo.com/details?id=21329046&stx=pizza&csz=Sunnyvale+CA&ed=OkhHFa160Sx2UXqpaqXDZAGyyKWrCO9wfqP24Mur1nNB2pqgQsi3DQxeSEK_Uj9fxQN4zNax
|
||||
Vitos Famous Pizza|1155 Reed Ave|Sunnyvale|(408) 246-8800|4.5|http://local.yahoo.com/details?id=21332026&stx=pizza&csz=Sunnyvale+CA&ed=QTqeMK160Sx0Mril0Jnu_RK0RF4vTvEspLb2s60hJTic2.RapYE82B6edOm18LAox7KOqkw-
|
||||
Round Table Pizza|101 Town And Countr|Sunnyvale|(408) 736-2242|3|http://local.yahoo.com/details?id=21340803&stx=pizza&csz=Sunnyvale+CA&ed=SiKr2K160SwJxDEvf_eAwROvFMpfCIqsVX3dSyYtvj6HomUPpdS92g9AIoaoZNtg.WNSGcT4hpk1JxxT
|
||||
Round Table Pizza|860 Old San Francisco Rd|Sunnyvale|(408) 245-9000|3|http://local.yahoo.com/details?id=21340791&stx=pizza&csz=Sunnyvale+CA&ed=NF3MAq160SzKHt2S1yk7tJKtIMvbW44yNlckp8Y5veL7w8DWvagJYLH2tGehl1cPcLGbR4kzMTi4cf1U7iP6YA--
|
||||
Domino's Pizza|992 W El Camino Real|Sunnyvale|(408) 736-3666|4|http://local.yahoo.com/details?id=21341882&stx=pizza&csz=Sunnyvale+CA&ed=_tzLZq160SyF.4GddMA07QiACQkYc84nqI0j3hvsAcfMemwlBCiezUltSm8_ppCH1Bo8SlklBj1QhuRp
|
||||
Little Caesars Pizza|1039 Sunnyvale Saratoga Rd|Sunnyvale|(408) 245-0607|3|http://local.yahoo.com/details?id=21330174&stx=pizza&csz=Sunnyvale+CA&ed=89myuK160Syd6uoWQ5fTb6uLid70P.ucvPaBKA92m7bc1aVSW5LGmRbGsSIqT8U5e2eA4Ki4nQHVAAhh5.SVNIAQ
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/* yadl_spaceid - Skip Stamping */
|
||||
|
||||
// Yahoo! proxy
|
||||
|
||||
// Hard-code hostname and path:
|
||||
define ('PATH', 'http://local.yahooapis.com/LocalSearchService/V2/localSearch');
|
||||
|
||||
$type = "text/xml";
|
||||
|
||||
// Get all query params
|
||||
$query = "?";
|
||||
foreach ($_GET as $key => $value) {
|
||||
if(($key == "output") && ($value == "json")) {
|
||||
$type = "application/json";
|
||||
}
|
||||
$query .= urlencode($key)."=".urlencode($value)."&";
|
||||
}
|
||||
|
||||
foreach ($_POST as $key => $value) {
|
||||
if(($key == "output") && ($value == "json")) {
|
||||
$type = "application/json";
|
||||
}
|
||||
$query .= $key."=".$value."&";
|
||||
}
|
||||
$query .= "appid=YahooDemo";
|
||||
$url = PATH.$query;
|
||||
|
||||
|
||||
// Open the Curl session
|
||||
$session = curl_init($url);
|
||||
|
||||
// Don't return HTTP headers. Do return the contents of the call
|
||||
curl_setopt($session, CURLOPT_HEADER, false);
|
||||
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
// Make the call
|
||||
$response = curl_exec($session);
|
||||
|
||||
header("Content-Type: ".$type);
|
||||
echo $response;
|
||||
curl_close($session);
|
||||
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,157 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Datatable with Autocomplete</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/autocomplete/assets/skins/sam/autocomplete.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/autocomplete/autocomplete-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Datatable with Autocomplete</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example uses two <a href="http://developer.yahoo.com/yui/autocomplete/">AutoComplete Controls</a> to populate a DataTable with data received via XHR from the Yahoo! Local webservice.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<style type="text/css">
|
||||
#autocomplete, #autocomplete_zip {
|
||||
height: 25px;
|
||||
}
|
||||
#dt_input, #dt_input_zip {
|
||||
position: static;
|
||||
width: 300px;
|
||||
}
|
||||
#dt_input_zip {
|
||||
width: 60px;
|
||||
}
|
||||
#dt_ac_container, #dt_ac_zip_container {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="autocomplete">
|
||||
<label for="dt_input">Search Term: </label><input id="dt_input" type="text" value="pizza">
|
||||
<div id="dt_ac_container"></div>
|
||||
</div>
|
||||
<div id="autocomplete_zip">
|
||||
<label for="dt_input_zip">Zip Code: </label><input id="dt_input_zip" type="text" value="94089">
|
||||
<div id="dt_ac_zip_container"></div>
|
||||
</div>
|
||||
|
||||
<div id="json"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var Dom = YAHOO.util.Dom,
|
||||
Event = YAHOO.util.Event,
|
||||
queryString = '&results=20&output=json',
|
||||
zip = null,
|
||||
myDataSource = null,
|
||||
myDataTable = null;
|
||||
|
||||
var getZip = function(query) {
|
||||
query = parseInt(query, 10);
|
||||
if (!YAHOO.lang.isNumber(query)) {
|
||||
query = zip;
|
||||
Dom.get('dt_input_zip').value = zip;
|
||||
YAHOO.log('Invalid zip code, must be a number', 'warn', 'example');
|
||||
}
|
||||
myDataSource.sendRequest('datatable=yes&zip=' + query + '&query=' + Dom.get('dt_input').value + queryString,
|
||||
myDataTable.onDataReturnInitializeTable, myDataTable);
|
||||
};
|
||||
var getTerms = function(query) {
|
||||
myDataSource.sendRequest('datatable=yes&query=' + query + '&zip=' + Dom.get('dt_input_zip').value + queryString,
|
||||
myDataTable.onDataReturnInitializeTable, myDataTable);
|
||||
};
|
||||
|
||||
Event.onDOMReady(function() {
|
||||
zip = Dom.get('dt_input_zip').value;
|
||||
|
||||
var oACDS = new YAHOO.widget.DS_JSFunction(getTerms);
|
||||
oACDS.queryMatchContains = true;
|
||||
var oAutoComp = new YAHOO.widget.AutoComplete("dt_input","dt_ac_container", oACDS);
|
||||
|
||||
|
||||
var oACDSZip = new YAHOO.widget.DS_JSFunction(getZip);
|
||||
oACDSZip.queryMatchContains = true;
|
||||
var oAutoCompZip = new YAHOO.widget.AutoComplete("dt_input_zip","dt_ac_zip_container", oACDSZip);
|
||||
//Don't query until we have 5 numbers for the zip code
|
||||
oAutoCompZip.minQueryLength = 5;
|
||||
|
||||
var formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{ key:"Title",
|
||||
label:"Name",
|
||||
sortable:true,
|
||||
formatter: formatUrl
|
||||
},
|
||||
{ key:"Phone" },
|
||||
{ key:"City" },
|
||||
{ key:"Rating.AverageRating",
|
||||
label:"Rating",
|
||||
formatter:YAHOO.widget.DataTable.formatNumber,
|
||||
sortable:true
|
||||
}
|
||||
];
|
||||
|
||||
myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.connXhrMode = "queueRequests";
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "ResultSet.Result",
|
||||
fields: [
|
||||
"Title",
|
||||
"Phone",
|
||||
"City",
|
||||
{
|
||||
key: "Rating.AverageRating",
|
||||
parser:YAHOO.util.DataSource.parseNumber
|
||||
},
|
||||
"ClickUrl"
|
||||
]
|
||||
};
|
||||
|
||||
myDataTable = new YAHOO.widget.DataTable("json", myColumnDefs,
|
||||
myDataSource, {initialRequest: 'datatable=yes&query=' + Dom.get('dt_input').value + '&zip=' + Dom.get('dt_input_zip').value + queryString });
|
||||
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,78 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Basic Example</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-liner { white-space:nowrap; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Basic Example</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A demonstration of the DataTable's basic feature set.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="basic"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Basic = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"id", sortable:true, resizeable:true},
|
||||
{key:"date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true},
|
||||
{key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true, resizeable:true},
|
||||
{key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true, resizeable:true},
|
||||
{key:"title", sortable:true, resizeable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["id","date","quantity","amount","title"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("basic",
|
||||
myColumnDefs, this.myDataSource, {caption:"DataTable Caption"});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,108 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Inline Cell Editing</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/calendar/assets/skins/sam/calendar.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/calendar/calendar-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-col-address pre { font-family:arial;font-size:100%; } /* Use PRE in first col to preserve linebreaks*/
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Inline Cell Editing</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates basic inline cell editing features, as well as
|
||||
more complex customizations, such as input validation and click-to-save interactions.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cellediting"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.InlineCellEditing = new function() {
|
||||
// Custom formatter for "address" column to preserve line breaks
|
||||
this.formatAddress = function(elCell, oRecord, oColumn, oData) {
|
||||
elCell.innerHTML = "<pre class=\"address\">" + oData + "</pre>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"uneditable"},
|
||||
{key:"address", formatter:this.formatAddress, editor:"textarea"},
|
||||
{key:"city", editor:"textbox"},
|
||||
{key:"state", editor:"dropdown", editorOptions:{dropdownOptions:YAHOO.example.Data.stateAbbrs}},
|
||||
{key:"amount", editor:"textbox", editorOptions:{validator:YAHOO.widget.DataTable.validateNumber}},
|
||||
{key:"active", editor:"radio", editorOptions:{radioOptions:["yes","no","maybe"],disableBtns:true}},
|
||||
{key:"colors", editor:"checkbox", editorOptions:{checkboxOptions:["red","yellow","blue"]}},
|
||||
{key:"last_login", formatter:YAHOO.widget.DataTable.formatDate, editor:"date"}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:YAHOO.util.DataSource.parseDate}]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("cellediting", myColumnDefs, this.myDataSource);
|
||||
|
||||
// Set up editing flow
|
||||
this.highlightEditableCell = function(oArgs) {
|
||||
var elCell = oArgs.target;
|
||||
if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
|
||||
this.highlightCell(elCell);
|
||||
}
|
||||
};
|
||||
this.myDataTable.subscribe("cellMouseoverEvent", this.highlightEditableCell);
|
||||
this.myDataTable.subscribe("cellMouseoutEvent", this.myDataTable.onEventUnhighlightCell);
|
||||
this.myDataTable.subscribe("cellClickEvent", this.myDataTable.onEventShowCellEditor);
|
||||
|
||||
// Hook into custom event to customize save-flow of "radio" editor
|
||||
this.myDataTable.subscribe("editorUpdateEvent", function(oArgs) {
|
||||
if(oArgs.editor.column.key === "active") {
|
||||
this.saveCellEditor();
|
||||
}
|
||||
});
|
||||
this.myDataTable.subscribe("editorBlurEvent", function(oArgs) {
|
||||
this.cancelCellEditor();
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,113 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Cell Selection</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-body { cursor:pointer; } /* when cells are selectable */
|
||||
#cellrange, #singlecell { margin-top:2em; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Cell Selection</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>These examples demonstrate "cellblock", "cellrange", and "singlecell"
|
||||
selection modes.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cellblock"></div>
|
||||
<div id="cellrange"></div>
|
||||
<div id="singlecell"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.CellSelection = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"col1", sortable:true},
|
||||
{key:"col2", sortable:true},
|
||||
{key:"col3", sortable:true},
|
||||
{key:"col4", sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["col0","col1","col2","col3","col4"]
|
||||
};
|
||||
|
||||
this.cellBlockSelectDataTable = new YAHOO.widget.DataTable("cellblock",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Cell-Block Selection Mode with Support for Modifier Keys",
|
||||
selectionMode:"cellblock"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
this.cellBlockSelectDataTable.subscribe("cellMouseoverEvent", this.cellBlockSelectDataTable.onEventHighlightCell);
|
||||
this.cellBlockSelectDataTable.subscribe("cellMouseoutEvent", this.cellBlockSelectDataTable.onEventUnhighlightCell);
|
||||
this.cellBlockSelectDataTable.subscribe("cellClickEvent", this.cellBlockSelectDataTable.onEventSelectCell);
|
||||
this.cellBlockSelectDataTable.subscribe("cellSelectEvent", this.cellBlockSelectDataTable.clearTextSelection);
|
||||
|
||||
this.cellRangeSelectDataTable = new YAHOO.widget.DataTable("cellrange",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Example: Cell-Range Selection Mode Support for Modifier Keys",
|
||||
selectionMode:"cellrange"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
this.cellRangeSelectDataTable.subscribe("cellMouseoverEvent", this.cellRangeSelectDataTable.onEventHighlightCell);
|
||||
this.cellRangeSelectDataTable.subscribe("cellMouseoutEvent", this.cellRangeSelectDataTable.onEventUnhighlightCell);
|
||||
this.cellRangeSelectDataTable.subscribe("cellClickEvent", this.cellRangeSelectDataTable.onEventSelectCell);
|
||||
this.cellRangeSelectDataTable.subscribe("cellSelectEvent", this.cellRangeSelectDataTable.clearTextSelection);
|
||||
|
||||
this.singleCellSelectDataTable = new YAHOO.widget.DataTable("singlecell",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Single-Cell Selection Mode with Modifier Keys Disabled",
|
||||
selectionMode:"singlecell"
|
||||
});
|
||||
|
||||
// Subscribe to events for cell selection
|
||||
this.singleCellSelectDataTable.subscribe("cellMouseoverEvent", this.singleCellSelectDataTable.onEventHighlightCell);
|
||||
this.singleCellSelectDataTable.subscribe("cellMouseoutEvent", this.singleCellSelectDataTable.onEventUnhighlightCell);
|
||||
this.singleCellSelectDataTable.subscribe("cellClickEvent", this.singleCellSelectDataTable.onEventSelectCell);
|
||||
this.singleCellSelectDataTable.subscribe("cellSelectEvent", this.singleCellSelectDataTable.clearTextSelection);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,100 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Client-side Pagination</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
#paginated {
|
||||
text-align: center;
|
||||
}
|
||||
#paginated table {
|
||||
margin-left:auto; margin-right:auto;
|
||||
}
|
||||
#paginated .yui-pg-container a {
|
||||
color: #00d;
|
||||
}
|
||||
#paginated .yui-pg-pages a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#paginated, #paginated .yui-dt-loading {
|
||||
text-align: center; background-color: transparent;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Client-side Pagination</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example retrieves a large data set in JSON format from a server script, then loads the data into a DataTable with client side pagination enabled.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="paginated"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady(function() {
|
||||
YAHOO.example.ClientPagination = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"id", label:"ID"},
|
||||
{key:"name", label:"Name"},
|
||||
{key:"date", label:"Date"},
|
||||
{key:"price", label:"Price"},
|
||||
{key:"number", label:"Number"}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?");
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "records",
|
||||
fields: ["id","name","date","price","number"]
|
||||
};
|
||||
|
||||
var oConfigs = {
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage: 15
|
||||
}),
|
||||
initialRequest: "results=504"
|
||||
};
|
||||
this.myDataTable = new YAHOO.widget.DataTable("paginated", myColumnDefs,
|
||||
this.myDataSource, oConfigs);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,88 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Client-side Sorting</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Client-side Sorting</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A custom sort handler has been defined in this example to enable custom nested
|
||||
sorting, such that clicking on the "States" Column will sort by states, and then
|
||||
by area code.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="sort"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.CustomSort = new function() {
|
||||
// Custom sort handler to sort by state and then by areacode
|
||||
// where a and b are Record instances to compare
|
||||
this.sortStates = function(a, b, desc) {
|
||||
// Deal with empty values
|
||||
if(!YAHOO.lang.isValue(a)) {
|
||||
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
|
||||
}
|
||||
else if(!YAHOO.lang.isValue(b)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First compare by state
|
||||
var comp = YAHOO.util.Sort.compare;
|
||||
var compState = comp(a.getData("state"), b.getData("state"), desc);
|
||||
|
||||
// If states are equal, then compare by areacode
|
||||
return (compState !== 0) ? compState : comp(a.getData("areacode"), b.getData("areacode"), desc);
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"areacode",label:"Area Codes",sortable:true},
|
||||
{key:"state",label:"States",sortable:true,sortOptions:{sortFunction:this.sortStates}}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.areacodes.slice(0,25));
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["areacode","state"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("sort", myColumnDefs,
|
||||
this.myDataSource, {sortedBy:{key:"areacode", dir:"asc"}});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,215 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#dt-example {width:45em;margin:0 auto;}
|
||||
#dt-options {text-align:right;margin:1em 0;}
|
||||
#dt-dlg {visibility:hidden;border:1px solid #808080;background-color:#E3E3E3;}
|
||||
#dt-dlg .hd {font-weight:bold;padding:1em;background:none;background-color:#E3E3E3;border-bottom:0;}
|
||||
#dt-dlg .ft {text-align:right;padding:.5em;background-color:#E3E3E3;}
|
||||
#dt-dlg .bd {height:10em;margin:0 1em;overflow:auto;border:1px solid black;background-color:white;}
|
||||
#dt-dlg .dt-dlg-pickercol {clear:both;padding:.5em 1em 3em;border-bottom:1px solid gray;}
|
||||
#dt-dlg .dt-dlg-pickerkey {float:left;}
|
||||
#dt-dlg .dt-dlg-pickerbtns {float:right;}
|
||||
|
||||
/* Container workarounds for Mac Gecko scrollbar issues */
|
||||
.yui-panel-container.hide-scrollbars #dt-dlg .bd {
|
||||
/* Hide scrollbars by default for Gecko on OS X */
|
||||
overflow: hidden;
|
||||
}
|
||||
.yui-panel-container.show-scrollbars #dt-dlg .bd {
|
||||
/* Show scrollbars for Gecko on OS X when the Panel is visible */
|
||||
overflow: auto;
|
||||
}
|
||||
#dt-dlg_c .underlay {overflow:hidden;}
|
||||
|
||||
|
||||
/* rounded corners */
|
||||
#dt-dlg .corner_tr {
|
||||
background-image: url( assets/img/tr.gif);
|
||||
position: absolute;
|
||||
background-repeat: no-repeat;
|
||||
top: -1px;
|
||||
right: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_tl {
|
||||
background-image: url( assets/img/tl.gif);
|
||||
background-repeat: no-repeat;
|
||||
position: absolute;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_br {
|
||||
background-image: url( assets/img/br.gif);
|
||||
position: absolute;
|
||||
background-repeat: no-repeat;
|
||||
bottom: -1px;
|
||||
right: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
#dt-dlg .corner_bl {
|
||||
background-image: url( assets/img/bl.gif);
|
||||
background-repeat: no-repeat;
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
left: -1px;
|
||||
height: 4px;
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.inprogress {position:absolute;} /* transitional progressive enhancement state */
|
||||
|
||||
.yui-dt-liner {white-space:nowrap;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body class="yui-skin-sam">
|
||||
<h1>Showing, Hiding, and Reordering Columns</h1>
|
||||
|
||||
<p>This example uses the Dialog and Button widgets to interactively show and hide Columns. Columns are also reorderable via built-in integration with the Drag and Drop Utility.</p>
|
||||
|
||||
<div id="dt-example">
|
||||
<div id="dt-options"><a id="dt-options-link" href="fallbacklink.html">Table Options</a></div>
|
||||
<div id="columnshowhide"></div>
|
||||
</div>
|
||||
|
||||
<div id="dt-dlg" class="inprogress">
|
||||
<span class="corner_tr"></span>
|
||||
<span class="corner_tl"></span>
|
||||
<span class="corner_br"></span>
|
||||
<span class="corner_bl"></span>
|
||||
<div class="hd">
|
||||
Choose which columns you would like to see:
|
||||
</div>
|
||||
<div id="dt-dlg-picker" class="bd">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="../../build/yuiloader/yuiloader-beta.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
var loader = new YAHOO.util.YUILoader();
|
||||
loader.insert({
|
||||
require: ["fonts", "dragdrop", "container", "button", "datatable"],
|
||||
base: '../../build/',
|
||||
filter: 'debug',
|
||||
allowRollup: false,
|
||||
onSuccess: function() {
|
||||
YAHOO.example.ColumnShowHide = new function() {
|
||||
// Define Columns
|
||||
var myColumnDefs = [
|
||||
{key:"address"},
|
||||
{key:"city"},
|
||||
{key:"state"},
|
||||
{key:"amount"},
|
||||
{key:"active"},
|
||||
{key:"colors"},
|
||||
{key:"last_login", formatter:YAHOO.widget.DataTable.formatDate}
|
||||
];
|
||||
|
||||
// Create DataSource
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.addresses);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["address","city","state","amount","active","colors",{key:"last_login",parser:YAHOO.util.DataSource.parseDate}]
|
||||
};
|
||||
|
||||
// Create DataTable
|
||||
var myDT = this.myDataTable = new YAHOO.widget.DataTable("columnshowhide", myColumnDefs, this.myDataSource, {draggableColumns:true});
|
||||
|
||||
// Shows dialog, creating one when necessary
|
||||
this.newCols = true;
|
||||
this.showDlg = function(e) {
|
||||
YAHOO.util.Event.stopEvent(e);
|
||||
|
||||
if(this.newCols) {
|
||||
// Populate Dialog
|
||||
// Using a template to create elements for the SimpleDialog
|
||||
var allColumns = myDT.getColumnSet().keys;
|
||||
var elPicker = YAHOO.util.Dom.get("dt-dlg-picker");
|
||||
var elTemplateCol = document.createElement("div");
|
||||
YAHOO.util.Dom.addClass(elTemplateCol, "dt-dlg-pickercol");
|
||||
var elTemplateKey = elTemplateCol.appendChild(document.createElement("span"));
|
||||
YAHOO.util.Dom.addClass(elTemplateKey, "dt-dlg-pickerkey");
|
||||
var elTemplateBtns = elTemplateCol.appendChild(document.createElement("span"));
|
||||
YAHOO.util.Dom.addClass(elTemplateBtns, "dt-dlg-pickerbtns");
|
||||
var onclickObj = {fn:this.handleButtonClick, obj:this, scope:false };
|
||||
|
||||
// Create one section in the SimpleDialog for each Column
|
||||
var elColumn, elKey, elButton, oButtonGrp;
|
||||
for(var i=0,l=allColumns.length;i<l;i++) {
|
||||
var oColumn = allColumns[i];
|
||||
|
||||
// Use the template
|
||||
elColumn = elTemplateCol.cloneNode(true);
|
||||
|
||||
// Write the Column key
|
||||
elKey = elColumn.firstChild;
|
||||
elKey.innerHTML = oColumn.getKey();
|
||||
|
||||
// Create a ButtonGroup
|
||||
oButtonGrp = new YAHOO.widget.ButtonGroup({
|
||||
id: "buttongrp"+i,
|
||||
name: oColumn.getKey(),
|
||||
container: elKey.nextSibling
|
||||
});
|
||||
oButtonGrp.addButtons([
|
||||
{ label: "Show", value: "Show", checked: ((!oColumn.hidden)), onclick: onclickObj},
|
||||
{ label: "Hide", value: "Hide", checked: ((oColumn.hidden)), onclick: onclickObj}
|
||||
]);
|
||||
|
||||
elPicker.appendChild(elColumn);
|
||||
}
|
||||
this.newCols = false;
|
||||
}
|
||||
this.myDlg.show();
|
||||
this.myDlg.center();
|
||||
};
|
||||
this.hideDlg = function(e) {
|
||||
this.hide();
|
||||
};
|
||||
this.handleButtonClick = function(e, oSelf) {
|
||||
var sKey = this.get("name");
|
||||
if(this.get("value") === "Hide") {
|
||||
// Hides a Column
|
||||
oSelf.myDataTable.hideColumn(sKey);
|
||||
}
|
||||
else {
|
||||
// Shows a Column
|
||||
oSelf.myDataTable.showColumn(sKey);
|
||||
}
|
||||
};
|
||||
|
||||
// Create the SimpleDialog
|
||||
YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
|
||||
this.myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
|
||||
width: "30em",
|
||||
visible: false,
|
||||
modal: true,
|
||||
buttons: [
|
||||
{ text:"Close", handler:this.hideDlg }
|
||||
]
|
||||
});
|
||||
this.myDlg.render();
|
||||
|
||||
// Nulls out myDlg to force a new one to be created
|
||||
myDT.subscribe("columnReorderEvent", function(){
|
||||
this.newCols = true;
|
||||
YAHOO.util.Event.purgeElement("dt-dlg-picker", true);
|
||||
YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = "";
|
||||
}, this, true);
|
||||
|
||||
// Hook up the SimpleDialog to the link
|
||||
YAHOO.util.Event.addListener("dt-options-link", "click", this.showDlg, this, true);
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Complex Example of Multiple Features</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/utilities/utilities.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Complex Example of Multiple Features</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>A demonstration of several DataTable features combined in one instance. The
|
||||
features implemented in this example require the Drag and Drop and Animation
|
||||
utilities.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="complex"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.MultipleFeatures = new function() {
|
||||
// Custom sort handler to sort by state and then by areacode
|
||||
// where a and b are Record instances to compare
|
||||
this.sortStates = function(a, b, desc) {
|
||||
// Deal with empty values
|
||||
if(!YAHOO.lang.isValue(a)) {
|
||||
return (!YAHOO.lang.isValue(b)) ? 0 : 1;
|
||||
}
|
||||
else if(!YAHOO.lang.isValue(b)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First compare by state
|
||||
var comp = YAHOO.util.Sort.compare;
|
||||
var compState = comp(a.getData("state"), b.getData("state"), desc);
|
||||
|
||||
// If states are equal, then compare by areacode
|
||||
return (compState !== 0) ? compState : comp(a.getData("areacode"), b.getData("areacode"), desc);
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"areacode",label:"Area Codes",width:100,resizeable:true,sortable:true},
|
||||
{key:"state",label:"States",width:250,resizeable:true,sortable:true,
|
||||
sortOptions:{sortFunction:this.sortStates}},
|
||||
{key:"notes",label:"Notes (editable)",editor:"textbox",resizeable:true,sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.areacodes);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["areacode","state"]
|
||||
};
|
||||
|
||||
var myConfigs = {
|
||||
sortedBy:{key:"areacode",dir:"asc"},
|
||||
paginator: new YAHOO.widget.Paginator({
|
||||
rowsPerPage: 25,
|
||||
dropdownOptions: [10,25,50,100],
|
||||
pageLinks: 5
|
||||
}),
|
||||
scrollable:true,
|
||||
height:"25em"
|
||||
}
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("complex", myColumnDefs, this.myDataSource, myConfigs);
|
||||
this.myDataTable.subscribe("rowClickEvent",this.myDataTable.onEventSelectRow);
|
||||
this.myDataTable.subscribe("cellDblclickEvent",this.myDataTable.onEventShowCellEditor);
|
||||
this.myDataTable.subscribe("editorBlurEvent", this.myDataTable.onEventSaveCellEditor);
|
||||
|
||||
// When cell is edited, pulse the color of the row yellow
|
||||
this.onCellEdit = function(oArgs) {
|
||||
var elCell = oArgs.editor.cell;
|
||||
var oOldData = oArgs.oldData;
|
||||
var oNewData = oArgs.newData;
|
||||
|
||||
// Grab the row el and the 2 colors
|
||||
var elRow = this.getTrEl(elCell);
|
||||
var origColor = YAHOO.util.Dom.getStyle(elRow.cells[0], "backgroundColor");
|
||||
var pulseColor = "#ff0";
|
||||
|
||||
// Create a temp anim instance that nulls out when anim is complete
|
||||
var rowColorAnim = new YAHOO.util.ColorAnim(elRow.cells, {
|
||||
backgroundColor:{to:origColor, from:pulseColor}, duration:2});
|
||||
var onComplete = function() {
|
||||
rowColorAnim = null;
|
||||
YAHOO.util.Dom.setStyle(elRow.cells, "backgroundColor", "");
|
||||
}
|
||||
rowColorAnim.onComplete.subscribe(onComplete);
|
||||
rowColorAnim.animate();
|
||||
}
|
||||
this.myDataTable.subscribe("editorSaveEvent", this.onCellEdit);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,109 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Context Menu Integration</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/menu/assets/skins/sam/menu.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/container/container_core-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/menu/menu-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
div.yuimenu .bd {
|
||||
zoom: normal;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Context Menu Integration</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Right-click on a row to see the ContextMenu integration in action. For more
|
||||
information on using the ContextMenu class please refer to the
|
||||
<a href="http://developer.yahoo.com/yui/menu/">documentation for the Menu control.</a></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="myContainer"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.ContextMenu = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"SKU", sortable:true},
|
||||
{key:"Quantity", sortable:true},
|
||||
{key:"Item", sortable:true},
|
||||
{key:"Description"}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.inventory);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["SKU","Quantity","Item","Description"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("myContainer", myColumnDefs, this.myDataSource);
|
||||
|
||||
this.onContextMenuClick = function(p_sType, p_aArgs, p_myDataTable) {
|
||||
var task = p_aArgs[1];
|
||||
if(task) {
|
||||
// Extract which TR element triggered the context menu
|
||||
var elRow = this.contextEventTarget;
|
||||
elRow = p_myDataTable.getTrEl(elRow);
|
||||
|
||||
if(elRow) {
|
||||
switch(task.index) {
|
||||
case 0: // Delete row upon confirmation
|
||||
var oRecord = p_myDataTable.getRecord(elRow);
|
||||
if(confirm("Are you sure you want to delete SKU " +
|
||||
oRecord.getData("SKU") + " (" +
|
||||
oRecord.getData("Description") + ")?")) {
|
||||
p_myDataTable.deleteRow(elRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.myContextMenu = new YAHOO.widget.ContextMenu("mycontextmenu",
|
||||
{trigger:this.myDataTable.getTbodyEl()});
|
||||
this.myContextMenu.addItem("Delete Item");
|
||||
// Render the ContextMenu instance to the parent container of the DataTable
|
||||
this.myContextMenu.render("myContainer");
|
||||
this.myContextMenu.clickEvent.subscribe(this.onContextMenuClick, this.myDataTable);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,142 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Progressive Enhancement</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Progressive Enhancement</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example creates a DataTable instance based on markup that already exists
|
||||
on the page. By progressively enhancing markup with higher order functionality,
|
||||
users who do not have JavaScript enabled are still able to view the page's content
|
||||
and experience core functionality.</p>
|
||||
|
||||
<p>In this example's code, note that we listen for the window "load" event
|
||||
before calling our function to be sure that the original table markup is fully
|
||||
rendered and available as a DataSource source for our DataTable instance.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="markup">
|
||||
<table id="accounts">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Due Date</th>
|
||||
<th>Account Number</th>
|
||||
<th>Quantity</th>
|
||||
<th>Amount Due</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>1/23/1999</td>
|
||||
<td>29e8548592d8c82</td>
|
||||
<td>12</td>
|
||||
<td>$150.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5/19/1999</td>
|
||||
<td>83849</td>
|
||||
<td>8</td>
|
||||
<td>$60.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8/9/1999</td>
|
||||
<td>11348</td>
|
||||
<td>1</td>
|
||||
<td>$34.99</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1/23/2000</td>
|
||||
<td>29e8548592d8c82</td>
|
||||
<td>10</td>
|
||||
<td>$1.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4/28/2000</td>
|
||||
<td>37892857482836437378273</td>
|
||||
<td>123</td>
|
||||
<td>$33.32</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1/23/2001</td>
|
||||
<td>83849</td>
|
||||
<td>5</td>
|
||||
<td>$15.00</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>9/30/2001</td>
|
||||
<td>224747</td>
|
||||
<td>14</td>
|
||||
<td>$56.78</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.EnhanceFromMarkup = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"due",label:"Due Date",formatter:YAHOO.widget.DataTable.formatDate,sortable:true},
|
||||
{key:"account",label:"Account Number", sortable:true},
|
||||
{key:"quantity",label:"Quantity",formatter:YAHOO.widget.DataTable.formatNumber,sortable:true},
|
||||
{key:"amount",label:"Amount Due",formatter:YAHOO.widget.DataTable.formatCurrency,sortable:true}
|
||||
];
|
||||
|
||||
this.parseNumberFromCurrency = function(sString) {
|
||||
// Remove dollar sign and make it a float
|
||||
return parseFloat(sString.substring(1));
|
||||
};
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("accounts"));
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: [{key:"due", parser:YAHOO.util.DataSource.parseDate},
|
||||
{key:"account"},
|
||||
{key:"quantity", parser:YAHOO.util.DataSource.parseNumber},
|
||||
{key:"amount", parser:this.parseNumberFromCurrency}
|
||||
]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("markup", myColumnDefs, this.myDataSource,
|
||||
{caption:"Example: Progressively Enhanced Table from Markup",
|
||||
sortedBy:{key:"due",dir:"desc"}}
|
||||
);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,117 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>XY-scrolling, Y-scrolling, and X-scrolling</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>XY-scrolling, Y-scrolling, and X-scrolling</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Scrolling can be enabled on a DataTable along the x, y, or xy-axes. Set the
|
||||
DataTable's "scrollable" value to "true", and set a width and/and or height string
|
||||
values.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<h2 class="first">XY Scrolling</h2>
|
||||
<div id="xyscrolling"></div>
|
||||
|
||||
<h2>Y Scrolling</h2>
|
||||
<div id="yscrolling"></div>
|
||||
|
||||
<h2>X Scrolling</h2>
|
||||
<div id="xscrolling"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Scrolling = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
var myColumnDefsY = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
var myColumnDefsX = [
|
||||
{key:"field1", width:50},
|
||||
{key:"field2", width:100, formatter:"date"},
|
||||
{key:"field3", width:50},
|
||||
{key:"field4", width:50},
|
||||
{key:"field5", width:50},
|
||||
{key:"field6", width:150}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.multitypes);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "items",
|
||||
fields: [
|
||||
{key:"field1"},
|
||||
{key:"field2", formatter:"date"},
|
||||
{key:"field3"},
|
||||
{key:"field4"},
|
||||
{key:"field5"},
|
||||
{key:"field6"}
|
||||
]
|
||||
};
|
||||
|
||||
// Set "scrollable:true" and set width and height string values
|
||||
this.myDataTableXY = new YAHOO.widget.DataTable("xyscrolling", myColumnDefs,
|
||||
this.myDataSource, {scrollable:true, width:"30em", height:"10em"});
|
||||
|
||||
// Set "scrollable:true" and set only height string value
|
||||
this.myDataTableY = new YAHOO.widget.DataTable("yscrolling", myColumnDefsY,
|
||||
this.myDataSource, {scrollable:true, height:"10em"});
|
||||
|
||||
// Set "scrollable:true" and set only width string value
|
||||
this.myDataTableX = new YAHOO.widget.DataTable("xscrolling", myColumnDefsX,
|
||||
this.myDataSource, {scrollable:true, width:"30em"});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,108 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="yui-skin-sam">
|
||||
<h1>Custom Cell Formatting</h1>
|
||||
<div id="formatting"></div>
|
||||
|
||||
<script type="text/javascript" src="../../build/yuiloader/yuiloader-beta.js"></script>
|
||||
<script type="text/javascript" src="./assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
var loader = new YAHOO.util.YUILoader();
|
||||
loader.insert({
|
||||
require: ["fonts", "datatable", "json"],
|
||||
filter: 'debug',
|
||||
base: '../../build/',
|
||||
onSuccess: function() {
|
||||
YAHOO.example.CustomFormatting = new function() {
|
||||
// Define a custom formatter for the Column labeled "flag"
|
||||
// draws an up icon if value of field3 is greater than 100,
|
||||
// otherwise renders a down icon
|
||||
this.myCustomFormatter = function(elCell, oRecord, oColumn, oData) {
|
||||
YAHOO.util.Dom.addClass(elCell, "flag");
|
||||
if(oRecord.getData("field3") > 100) {
|
||||
elCell.innerHTML = ' <img src="../../build/datatable/assets/skins/sam/dt-arrow-up.png">';
|
||||
}
|
||||
else {
|
||||
elCell.innerHTML = ' <img src="../../build/datatable/assets/skins/sam/dt-arrow-dn.png">';
|
||||
}
|
||||
};
|
||||
|
||||
// Add the custom formatter to the shortcuts
|
||||
YAHOO.widget.DataTable.Formatter.myCustom = this.myCustomFormatter;
|
||||
|
||||
// Override the built-in formatter
|
||||
YAHOO.widget.DataTable.formatEmail = function(elCell, oRecord, oColumn, oData) {
|
||||
var user = oData;
|
||||
elCell.innerHTML = "<a href=\"mailto:" + user + "@mycompany.com\">" + user + "</a>";
|
||||
};
|
||||
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"flag", formatter:"myCustom"}, // use custom shortcut
|
||||
{key:"radio", formatter:"radio"}, // use the built-in radio formatter
|
||||
{key:"check", formatter:"checkbox"}, // use the built-in checkbox formatter (shortcut)
|
||||
{key:"button", label:"Show record data", formatter:YAHOO.widget.DataTable.formatButton}, // use the built-in button formatter
|
||||
{key:"field1", formatter:"dropdown", dropdownOptions:["apples","bananas","cherries"],sortable:true},
|
||||
{key:"field2", sortable:true, formatter:"date"}, // use the built-in date formatter
|
||||
{key:"field3", sortable:true},
|
||||
{key:"field4", sortable:true, formatter:"currency"}, // use the built-in currency formatter
|
||||
{key:"field5", sortable:true, formatter:YAHOO.widget.DataTable.formatEmail}, // use the overridden email formatter
|
||||
{key:"field6", sortable:true, formatter:YAHOO.widget.DataTable.formatLink} // use the built-in link formatter
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.multitypes);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "items",
|
||||
// Use the parse methods to populate the RecordSet with the right data types
|
||||
fields: [
|
||||
{key:"field1", parser:YAHOO.util.DataSource.parseString}, // point to the string parser
|
||||
{key:"field2", parser:YAHOO.util.DataSource.parseDate}, // point to the date parser
|
||||
{key:"field3", parser:YAHOO.util.DataSource.parseNumber}, // point to the number parser
|
||||
{key:"field4", parser:YAHOO.util.DataSource.parseNumber}, // point to the number parser
|
||||
{key:"field5"}, // this is already string data so no parser needed
|
||||
{key:"field6"} // this is already string data so no parser needed
|
||||
]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("formatting", myColumnDefs, this.myDataSource);
|
||||
|
||||
var lastSelectedRadioRecord = null;
|
||||
this.myDataTable.subscribe("radioClickEvent", function(oArgs){
|
||||
if(lastSelectedRadioRecord) {
|
||||
lastSelectedRadioRecord.setData("radio",false);
|
||||
}
|
||||
var elRadio = oArgs.target;
|
||||
var oRecord = this.getRecord(elRadio);
|
||||
oRecord.setData("radio",true);
|
||||
lastSelectedRadioRecord = oRecord;
|
||||
var name = oRecord.getData("field5");
|
||||
});
|
||||
|
||||
this.myDataTable.subscribe("checkboxClickEvent", function(oArgs){
|
||||
var elCheckbox = oArgs.target;
|
||||
var oRecord = this.getRecord(elCheckbox);
|
||||
oRecord.setData("check",elCheckbox.checked);
|
||||
});
|
||||
|
||||
this.myDataTable.subscribe("buttonClickEvent", function(oArgs){
|
||||
var oRecord = this.getRecord(oArgs.target);
|
||||
alert(YAHOO.lang.dump(oRecord.getData()));
|
||||
});
|
||||
|
||||
this.myDataTable.subscribe("dropdownChangeEvent", function(oArgs){
|
||||
var elDropdown = oArgs.target;
|
||||
var oRecord = this.getRecord(elDropdown);
|
||||
oRecord.setData("field1",elDropdown.options[elDropdown.selectedIndex].value);
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,97 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Highlighting Cells, Rows, or Columns</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/container/assets/skins/sam/container.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/container/container-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Highlighting Cells, Rows, or Columns</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="cell"></div>
|
||||
<div id="row"></div>
|
||||
<div id="column"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Highlighting = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"Page"},
|
||||
{key:"VisitsThisMonth"},
|
||||
{key:"VisitsThisYear"},
|
||||
{key:"ViewsThisMonth"},
|
||||
{key:"ViewsThisYear"}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["Page","VisitsThisMonth","VisitsThisYear","ViewsThisMonth","ViewsThisYear"]
|
||||
};
|
||||
|
||||
this.cellHighlightDataTable = new YAHOO.widget.DataTable("cell",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Example: Cell Highlighting"
|
||||
});
|
||||
// Enable cell highlighting
|
||||
this.cellHighlightDataTable.subscribe("cellMouseoverEvent", this.cellHighlightDataTable.onEventHighlightCell);
|
||||
this.cellHighlightDataTable.subscribe("cellMouseoutEvent", this.cellHighlightDataTable.onEventUnhighlightCell);
|
||||
|
||||
this.rowHighlightDataTable = new YAHOO.widget.DataTable("row",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Example: Row Highlighting"
|
||||
});
|
||||
// Enable row highlighting
|
||||
this.rowHighlightDataTable.subscribe("rowMouseoverEvent", this.rowHighlightDataTable.onEventHighlightRow);
|
||||
this.rowHighlightDataTable.subscribe("rowMouseoutEvent", this.rowHighlightDataTable.onEventUnhighlightRow);
|
||||
|
||||
this.colHighlightDataTable = new YAHOO.widget.DataTable("column",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Example: Column Highlighting"
|
||||
});
|
||||
// Enable Column highlighting
|
||||
this.colHighlightDataTable.subscribe("theadCellMouseoverEvent", this.colHighlightDataTable.onEventHighlightColumn);
|
||||
this.colHighlightDataTable.subscribe("theadCellMouseoutEvent", this.colHighlightDataTable.onEventUnhighlightColumn);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Nested Headers</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Nested Headers</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p></p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="nested"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.NestedHeaders = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"page", label:"Page", sortable:true, resizeable:true},
|
||||
{label:"Statistics", formatter:YAHOO.widget.DataTable.formatNumber, children:[
|
||||
{label:"Visits",
|
||||
children: [
|
||||
{key:"visitsmonth", label:"This Month",sortable:true, resizeable:true},
|
||||
{key:"visitsytd", label:"YTD", abbr:"Year to Date",sortable:true, resizeable:true}
|
||||
]
|
||||
},
|
||||
{label:"Views",
|
||||
children: [
|
||||
{key:"viewsmonth", label:"This Month",sortable:true, resizeable:true},
|
||||
{key:"viewsytd", label:"YTD", abbr:"Year to Date",sortable:true, resizeable:true}
|
||||
]
|
||||
|
||||
}
|
||||
]}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.webstats);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["page","visitsmonth","visitsytd","viewsmonth","viewsytd"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("nested", myColumnDefs, this.myDataSource);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,143 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Adding and Deleting Rows</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/button/assets/skins/sam/button.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/dragdrop/dragdrop-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#buttons {margin-bottom: 1em;}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Adding and Deleting Rows</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>Adding and deleting rows dynamically.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="buttons">
|
||||
<span id="addrow" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Add one row</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="deleterow" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Delete top row</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="addrows" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button">Add 20 rows</button>
|
||||
</span>
|
||||
</span>
|
||||
<span id="deleterows" class="yui-button yui-push-button">
|
||||
<span class="first-child">
|
||||
<button type="button" name="button5">Delete top 20 rows</button>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div id="basic"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.DynamicData = new function() {
|
||||
var data = {one:"one",two:"two",three:"three"};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"row",resizeable:true,sortable:true},
|
||||
{key:"one",resizeable:true},
|
||||
{key:"two",resizeable:true},
|
||||
{key:"three",resizeable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource([]);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
this.myDataSource.responseSchema = {
|
||||
fields: ["one","two","three"]
|
||||
};
|
||||
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("basic",
|
||||
myColumnDefs, this.myDataSource, {});
|
||||
|
||||
var i=1;
|
||||
|
||||
YAHOO.util.Event.addListener("addrow","click",function() {
|
||||
var record = YAHOO.widget.DataTable._cloneObject(data);
|
||||
record.row = i++;
|
||||
this.myDataTable.addRow(record);
|
||||
},this,true);
|
||||
|
||||
YAHOO.util.Event.addListener("deleterow","click",function() {
|
||||
if(this.myDataTable.getRecordSet().getLength() > 0) {
|
||||
this.myDataTable.deleteRow(0);
|
||||
}
|
||||
},this,true);
|
||||
|
||||
|
||||
YAHOO.util.Event.addListener("addrows","click",function(e) {
|
||||
var myArray = [];
|
||||
for(var l=i;i<=l+19;i++) {
|
||||
var record = YAHOO.widget.DataTable._cloneObject(data);
|
||||
record.row = i;
|
||||
myArray.push(record);
|
||||
}
|
||||
this.myDataTable.addRows(myArray);
|
||||
},this,true);
|
||||
|
||||
YAHOO.util.Event.addListener("deleterows","click",function() {
|
||||
var length = this.myDataTable.getRecordSet().getLength();
|
||||
if(length > 0) {
|
||||
var count = (length > 19) ? 20 : length;
|
||||
this.myDataTable.deleteRows(0,count);
|
||||
}
|
||||
},this,true);
|
||||
|
||||
|
||||
var oPushButton4 = new YAHOO.widget.Button("addrow");
|
||||
var oPushButton5 = new YAHOO.widget.Button("addrows");
|
||||
var oPushButton6 = new YAHOO.widget.Button("deleterow");
|
||||
var oPushButton6 = new YAHOO.widget.Button("deleterows");
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,106 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Row Selection</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
.yui-skin-sam .yui-dt-body { cursor:pointer; } /* when rows are selectable */
|
||||
#single { margin-top:2em; }
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Row Selection</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>These examples demonstrate "standard" row selection mode and "single" row
|
||||
selection mode.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="standard"></div>
|
||||
<div id="single"></div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.RowSelection = new function() {
|
||||
var myColumnDefs = [
|
||||
{key:"Date",formatter:YAHOO.widget.DataTable.formatDate, sortable:true},
|
||||
{key:"To", sortable:true},
|
||||
{key:"From", sortable:true},
|
||||
{key:"Subject", sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.emails);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "messages",
|
||||
fields: ["Date","To","From","Subject","XID","Date","Attachment"]
|
||||
};
|
||||
|
||||
this.standardSelectDataTable = new YAHOO.widget.DataTable("standard",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Standard Row Selection with Support for Modifier Keys"
|
||||
});
|
||||
|
||||
// Subscribe to events for row selection
|
||||
this.standardSelectDataTable.subscribe("rowMouseoverEvent", this.standardSelectDataTable.onEventHighlightRow);
|
||||
this.standardSelectDataTable.subscribe("rowMouseoutEvent", this.standardSelectDataTable.onEventUnhighlightRow);
|
||||
this.standardSelectDataTable.subscribe("rowClickEvent", this.standardSelectDataTable.onEventSelectRow);
|
||||
|
||||
// Programmatically select the first row
|
||||
this.standardSelectDataTable.selectRow(this.standardSelectDataTable.getTrEl(0));
|
||||
// Programmatically bring focus to the instance so arrow selection works immediately
|
||||
this.standardSelectDataTable.focus();
|
||||
|
||||
this.singleSelectDataTable = new YAHOO.widget.DataTable("single",
|
||||
myColumnDefs, this.myDataSource, {
|
||||
caption:"Single-Row Selection with Modifier Keys Disabled",
|
||||
selectionMode:"single"
|
||||
});
|
||||
|
||||
// Subscribe to events for row selection
|
||||
this.singleSelectDataTable.subscribe("rowMouseoverEvent", this.singleSelectDataTable.onEventHighlightRow);
|
||||
this.singleSelectDataTable.subscribe("rowMouseoutEvent", this.singleSelectDataTable.onEventUnhighlightRow);
|
||||
this.singleSelectDataTable.subscribe("rowClickEvent", this.singleSelectDataTable.onEventSelectRow);
|
||||
|
||||
// Programmatically select the first row
|
||||
this.singleSelectDataTable.selectRow(this.singleSelectDataTable.getTrEl(0));
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,219 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Server-side Pagination and Sorting, with Browser History Manager</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/history/history-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#dt-pag-nav { margin-bottom:1ex; } /* custom pagination UI */
|
||||
#dt-pag-nav a {
|
||||
color: #00c;
|
||||
text-decoration: underline;
|
||||
}
|
||||
#yui-history-iframe {
|
||||
position:absolute;
|
||||
top:0; left:0;
|
||||
width:1px; height:1px; /* avoid scrollbars */
|
||||
visibility:hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Server-side Pagination and Sorting, with Browser History Manager</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example combines server-side pagination and sorting with the Browser
|
||||
History Manager for managing states.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<iframe id="yui-history-iframe" src="assets/html/blank.html"></iframe>
|
||||
<input id="yui-history-field" type="hidden">
|
||||
|
||||
<div id="dt-pag-nav"></div>
|
||||
<div id="serverintegration"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
var History = YAHOO.util.History,
|
||||
myPaginator, // to hold the Paginator instance
|
||||
myDataSource, // to hold the DataSource instance
|
||||
myDataTable; // to hold the DataTable instance
|
||||
|
||||
// function to generate a query string for the DataSource. Also used
|
||||
// as the state indicator for the History Manager
|
||||
var generateStateString = function (start,key,dir) {
|
||||
start = start || 0;
|
||||
key = key || 'id';
|
||||
dir = dir || 'asc';
|
||||
return "results=15&startIndex="+start+"&sort="+key+"&dir="+dir;
|
||||
};
|
||||
|
||||
// function to extract the key values from the state string
|
||||
var parseStateString = function (state) {
|
||||
return {
|
||||
results : 15,
|
||||
startIndex : /\bstartIndex=(\d+)/.test(state) ? parseInt(RegExp.$1) : 0,
|
||||
sort : /\bsort=(\w+)/.test(state) ? RegExp.$1 : 'id',
|
||||
dir : /\bdir=(\w+)/.test(state) ? RegExp.$1 : 'asc'
|
||||
};
|
||||
};
|
||||
|
||||
// function used to intercept pagination requests
|
||||
var handlePagination = function (state,datatable) {
|
||||
var sortedBy = datatable.get('sortedBy');
|
||||
|
||||
var newState = generateStateString(
|
||||
state.recordOffset,
|
||||
sortedBy.key,
|
||||
sortedBy.dir);
|
||||
|
||||
History.navigate("myDataTable",newState);
|
||||
};
|
||||
|
||||
// function used to intercept sorting requests
|
||||
var handleSorting = function (oColumn) {
|
||||
// Which direction
|
||||
var sDir = "asc";
|
||||
|
||||
// Already sorted?
|
||||
if(oColumn.key === this.get("sortedBy").key) {
|
||||
sDir = (this.get("sortedBy").dir === "asc") ?
|
||||
"desc" : "asc";
|
||||
}
|
||||
|
||||
var newBookmark = generateStateString(0, oColumn.key, sDir);
|
||||
|
||||
YAHOO.util.History.navigate("myDataTable", newBookmark);
|
||||
};
|
||||
|
||||
var handleHistoryNavigation = function (state) {
|
||||
// Create a payload to pass through the DataSource request to the
|
||||
// handler
|
||||
var parsed = parseStateString(state);
|
||||
|
||||
// Use the DataTable's baked in server-side pagination handler
|
||||
myDataSource.sendRequest(state,{
|
||||
success : myDataTable.onDataReturnSetRows,
|
||||
failure : myDataTable.onDataReturnSetRows,
|
||||
scope : myDataTable
|
||||
});
|
||||
};
|
||||
|
||||
var initialState = History.getBookmarkedState('myDataTable') ||
|
||||
generateStateString(0,'id','asc');
|
||||
|
||||
History.register('myDataTable',initialState, handleHistoryNavigation);
|
||||
|
||||
History.onReady(function() {
|
||||
// Pull the state from the History Manager, or default from the
|
||||
// initial state. Parse the state string into an object literal.
|
||||
var initialRequest = History.getCurrentState('myDataTable') ||
|
||||
initialState,
|
||||
state = parseStateString(initialRequest);
|
||||
|
||||
// Create the DataSource
|
||||
myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?");
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
myDataSource.responseSchema = {
|
||||
resultsList: "records",
|
||||
fields: ["id","name","date","price"],
|
||||
metaFields: {
|
||||
totalRecords: "totalRecords",
|
||||
paginationRecordOffset : "startIndex",
|
||||
sortKey: "sort",
|
||||
sortDir: "dir"
|
||||
}
|
||||
};
|
||||
|
||||
// Column definitions
|
||||
var myColumnDefs = [
|
||||
{key:"id", label:"ID", sortable:true},
|
||||
{key:"name", label:"Name", sortable:true},
|
||||
{key:"date", label:"Date", sortable:true},
|
||||
{key:"price", label:"Price", sortable:true}
|
||||
];
|
||||
|
||||
// Create the DataTable configuration and Paginator using the state
|
||||
// information we pulled from the History Manager
|
||||
myPaginator = new YAHOO.widget.Paginator({
|
||||
rowsPerPage : state.results,
|
||||
recordOffset : state.startIndex,
|
||||
containers : ['dt-pag-nav'],
|
||||
template : "{PreviousPageLink} {CurrentPageReport} {NextPageLink}",
|
||||
pageReportTemplate : "Showing items {startIndex} - {endIndex} of {totalRecords}"
|
||||
});
|
||||
|
||||
var myConfig = {
|
||||
paginator : myPaginator,
|
||||
paginationEventHandler : handlePagination,
|
||||
// generateRequest : generateStateString, // moot
|
||||
sortedBy : {
|
||||
key : state.sort,
|
||||
dir : state.dir
|
||||
},
|
||||
initialRequest : initialRequest
|
||||
};
|
||||
|
||||
// Instantiate DataTable
|
||||
myDataTable = new YAHOO.widget.DataTable(
|
||||
"serverintegration", // The dom element to contain the DataTable
|
||||
myColumnDefs, // What columns will display
|
||||
myDataSource, // The DataSource for our records
|
||||
myConfig // Other configurations
|
||||
);
|
||||
|
||||
// Listen to header link clicks to sort the column
|
||||
myDataTable.subscribe('theadCellClickEvent', myDataTable.onEventSortColumn);
|
||||
|
||||
// Override the DataTable's sortColumn method with our intercept handler
|
||||
myDataTable.sortColumn = handleSorting;
|
||||
|
||||
// Add the example objects to the YAHOO.example namespace for inspection
|
||||
YAHOO.example.ServerIntegration = {
|
||||
myPaginator : myPaginator,
|
||||
myDataSource : myDataSource,
|
||||
myDataTable : myDataTable
|
||||
};
|
||||
});
|
||||
|
||||
YAHOO.util.History.initialize("yui-history-field", "yui-history-iframe");
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,82 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="yui-skin-sam">
|
||||
<h1>Server-side Sorting</h1>
|
||||
<div id="serversorting"></div>
|
||||
|
||||
<script type="text/javascript" src="../../build/yuiloader/yuiloader-beta.js"></script>
|
||||
<script type="text/javascript">
|
||||
var loader = new YAHOO.util.YUILoader();
|
||||
loader.insert({
|
||||
require: ["fonts", "connection", "json", "datatable"],
|
||||
base: '../../build/',
|
||||
filter: 'debug',
|
||||
onSuccess: function() {
|
||||
YAHOO.example.ServerSorting = new function() {
|
||||
// Column definitions
|
||||
var myColumnDefs = [
|
||||
{key:"id", label:"ID", sortable:true},
|
||||
{key:"name", label:"Name", sortable:true},
|
||||
{key:"date", label:"Date", sortable:true},
|
||||
{key:"price", label:"Price", sortable:true},
|
||||
{key:"number", label:"Number", sortable:true}
|
||||
];
|
||||
|
||||
// DataSource instance
|
||||
this.myDataSource = new YAHOO.util.DataSource("assets/php/json_proxy.php?");
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "records",
|
||||
fields: ["id","name","date","price","number"]
|
||||
};
|
||||
|
||||
// DataTable instance
|
||||
var oConfigs = {
|
||||
initialRequest: "sort=id&dir=asc&results=100", // Server parameters for initial request
|
||||
sortedBy: {key:"id", dir:YAHOO.widget.DataTable.CLASS_ASC}, // Set up initial column headers UI
|
||||
renderLoopSize: 25 // Bump up to account for large number of rows to display
|
||||
};
|
||||
this.myDataTable = new YAHOO.widget.DataTable("serversorting", myColumnDefs,
|
||||
this.myDataSource, oConfigs);
|
||||
|
||||
// Override function for custom server-side sorting
|
||||
this.myDataTable.sortColumn = function(oColumn) {
|
||||
// Default ascending
|
||||
var sDir = "asc"
|
||||
|
||||
// If already sorted, sort in opposite direction
|
||||
if(oColumn.key === this.get("sortedBy").key) {
|
||||
sDir = (this.get("sortedBy").dir === YAHOO.widget.DataTable.CLASS_ASC) ?
|
||||
"desc" : "asc";
|
||||
}
|
||||
|
||||
// Pass in sort values to server request
|
||||
var newRequest = "sort=" + oColumn.key + "&dir=" + sDir + "&results=100&startIndex=0";
|
||||
|
||||
// Create callback for data request
|
||||
var oCallback = {
|
||||
success: this.onDataReturnInitializeTable,
|
||||
failure: this.onDataReturnInitializeTable,
|
||||
scope: this,
|
||||
argument: {
|
||||
// Pass in sort values so UI can be updated in callback function
|
||||
sorting: {
|
||||
key: oColumn.key,
|
||||
dir: (sDir === "asc") ? YAHOO.widget.DataTable.CLASS_ASC : YAHOO.widget.DataTable.CLASS_DESC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Send the request
|
||||
this.getDataSource().sendRequest(newRequest, oCallback);
|
||||
};
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,94 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>JSON Data Over XHR</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>JSON Data Over XHR</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example populates a DataTable with data received via XHR from the Yahoo!
|
||||
Local webservice.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="json"></div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_JSON = new function() {
|
||||
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:this.formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"Rating.AverageRating", label:"Rating", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
|
||||
this.myDataSource.connXhrMode = "queueRequests";
|
||||
this.myDataSource.responseSchema = {
|
||||
resultsList: "ResultSet.Result",
|
||||
fields: ["Title","Phone","City",{key:"Rating.AverageRating",parser:YAHOO.util.DataSource.parseNumber},"ClickUrl"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("json", myColumnDefs,
|
||||
this.myDataSource, {initialRequest:"query=pizza&zip=94089&results=10&output=json"});
|
||||
|
||||
var callback1 = {
|
||||
success : this.myDataTable.onDataReturnAppendRows,
|
||||
failure : this.myDataTable.onDataReturnAppendRows,
|
||||
scope : this.myDataTable
|
||||
};
|
||||
this.myDataSource.sendRequest("query=mexican&zip=94089&results=10&output=json",
|
||||
callback1);
|
||||
|
||||
var callback2 = {
|
||||
success : this.myDataTable.onDataReturnInsertRows,
|
||||
failure : this.myDataTable.onDataReturnInsertRows,
|
||||
scope : this.myDataTable
|
||||
};
|
||||
this.myDataSource.sendRequest("query=chinese&zip=94089&results=10&output=json",
|
||||
callback2);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,84 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Local XML Data</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Local XML Data</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This DataTable is populated with XML data from a webservice that is held in local memory in the
|
||||
JavaScript variable xmlDoc.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="localxml"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.Local_XML = new function() {
|
||||
this.connectionCallback = {
|
||||
success: function(o) {
|
||||
var xmlDoc = o.responseXML;
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:this.formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"AverageRating", label:"Rating",formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource(xmlDoc);
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultNode: "Result",
|
||||
fields: ["Title","Phone","City",{key:"AverageRating",parser:YAHOO.util.DataSource.parseNumber},"ClickUrl"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("localxml", myColumnDefs, this.myDataSource);
|
||||
|
||||
},
|
||||
failure: function(o) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
this.getXML = YAHOO.util.Connect.asyncRequest("GET",
|
||||
"assets/php/ylocal_proxy.php?query=pizza&zip=94089&results=10",
|
||||
this.connectionCallback);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,76 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>XML Data Over XHR With POST</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
<!--there is no custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>XML Data Over XHR With POST</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This examples makes a POST query to the Yahoo! Local webservice to populate
|
||||
a DataTable.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="xml"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_XML = new function() {
|
||||
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("ClickUrl") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Title", label:"Name", sortable:true, formatter:this.formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"AverageRating", label:"Rating",formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource("assets/php/ylocal_proxy.php?");
|
||||
this.myDataSource.connMethodPost = true;
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_XML;
|
||||
this.myDataSource.responseSchema = {
|
||||
resultNode: "Result",
|
||||
fields: ["Title","Phone","City",{key:"AverageRating",parser:YAHOO.util.DataSource.parseNumber},"ClickUrl"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("xml", myColumnDefs,
|
||||
this.myDataSource, {initialRequest:"query=pizza&zip=94089&results=10"});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,114 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Textual Data Over XHR</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
/* custom styles for this example */
|
||||
#textWithHeaderData {margin-top:2em;}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Textual Data Over XHR</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates how to populate a DataTable with delimited text
|
||||
data over XHR. In the second instance, the data includes header data as the first
|
||||
row, which is parsed out with a custom implementation of the DataSource method
|
||||
doBeforeCallback().</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="text"></div>
|
||||
<div id="textWithHeaderData"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.addListener(window, "load", function() {
|
||||
YAHOO.example.XHR_Text = new function() {
|
||||
this.formatUrl = function(elCell, oRecord, oColumn, sData) {
|
||||
elCell.innerHTML = "<a href='" + oRecord.getData("Url") + "' target='_blank'>" + sData + "</a>";
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"Name", sortable:true, formatter:this.formatUrl},
|
||||
{key:"Phone"},
|
||||
{key:"City"},
|
||||
{key:"Rating", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
|
||||
];
|
||||
|
||||
this.myDataSource = new YAHOO.util.DataSource("assets/php/text_proxy.txt?");
|
||||
this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
|
||||
this.myDataSource.responseSchema = {
|
||||
recordDelim: "\n",
|
||||
fieldDelim: "|",
|
||||
fields: ["Name","Address","City","Phone",{key:"Rating",parser:YAHOO.util.DataSource.parseNumber},"Url"]
|
||||
};
|
||||
|
||||
this.myDataTable = new YAHOO.widget.DataTable("text", myColumnDefs,
|
||||
this.myDataSource, {caption:"Example: Textual Data Over XHR"});
|
||||
|
||||
|
||||
|
||||
var moreColumnDefs = [
|
||||
{key:"Restaurant", sortable:true, formatter:this.formatUrl},
|
||||
{key:"Location"},
|
||||
{key:"Town"},
|
||||
{key:"Stars", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true}
|
||||
];
|
||||
|
||||
this.anotherDataSource = new YAHOO.util.DataSource("assets/php/text_with_headers_proxy.txt?");
|
||||
this.anotherDataSource.responseType = YAHOO.util.DataSource.TYPE_TEXT;
|
||||
this.anotherDataSource.responseSchema = {
|
||||
recordDelim: "\n",
|
||||
fieldDelim: "|",
|
||||
fields: ["Restaurant","Location","Town","Telephone",{key:"Stars",parser:YAHOO.util.DataSource.parseNumber},"Website"]
|
||||
};
|
||||
// Upgrade note: As of 2.5.0, the second argument is the full type-converted
|
||||
// response from the live data, and not the unconverted raw response
|
||||
this.anotherDataSource.doBeforeCallback = function(oRequest, oFullResponse, oParsedResponse) {
|
||||
// Remove the first result (i.e., the headers);
|
||||
oParsedResponse.results.shift();
|
||||
return oParsedResponse;
|
||||
};
|
||||
|
||||
this.anotherDataTable = new YAHOO.widget.DataTable("textWithHeaderData", moreColumnDefs,
|
||||
this.anotherDataSource, {caption:"Example: First Record Holds Header Data"});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,110 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Server-side Pagination</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/connection/connection-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
#paging a {
|
||||
color: #0000de;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Server-side Pagination</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example illustrates how to configure a DataTable instance to page through a large data set managed on the server.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="demo">
|
||||
<div id="paging"></div>
|
||||
<div id="dt"></div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
var DataSource = YAHOO.util.DataSource,
|
||||
DataTable = YAHOO.widget.DataTable,
|
||||
Paginator = YAHOO.widget.Paginator;
|
||||
|
||||
var mySource = new DataSource('assets/php/json_proxy.php?');
|
||||
mySource.responseType = DataSource.TYPE_JSON;
|
||||
mySource.responseSchema = {
|
||||
resultsList : 'records',
|
||||
fields : [
|
||||
'id','name','date','price','number','address','company',
|
||||
'desc','age','title','phone','email','zip','country'],
|
||||
metaFields : {
|
||||
totalRecords: 'totalRecords' // The totalRecords meta field is
|
||||
// a "magic" meta, and will be passed
|
||||
// to the Paginator.
|
||||
}
|
||||
};
|
||||
|
||||
var buildQueryString = function (state,dt) {
|
||||
return "startIndex=" + state.pagination.recordOffset +
|
||||
"&results=" + state.pagination.rowsPerPage;
|
||||
};
|
||||
|
||||
var myPaginator = new Paginator({
|
||||
containers : ['paging'],
|
||||
pageLinks : 5,
|
||||
rowsPerPage : 15,
|
||||
rowsPerPageOptions : [15,30,60],
|
||||
template : "<strong>{CurrentPageReport}</strong> {PreviousPageLink} {PageLinks} {NextPageLink} {RowsPerPageDropdown}"
|
||||
});
|
||||
|
||||
var myTableConfig = {
|
||||
initialRequest : 'startIndex=0&results=25',
|
||||
generateRequest : buildQueryString,
|
||||
paginationEventHandler : DataTable.handleDataSourcePagination,
|
||||
paginator : myPaginator
|
||||
};
|
||||
|
||||
var myColumnDefs = [
|
||||
{key:"id"},
|
||||
{key:"date"},
|
||||
{key:"price"},
|
||||
{key:"age"},
|
||||
{key:"desc"}
|
||||
];
|
||||
|
||||
var myTable = new DataTable('dt', myColumnDefs, mySource, myTableConfig);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,275 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<title>Configuring the Paginator</title>
|
||||
|
||||
<style type="text/css">
|
||||
/*margin and padding on body element
|
||||
can introduce errors in determining
|
||||
element position and are not recommended;
|
||||
we turn them off as a foundation for YUI
|
||||
CSS treatments. */
|
||||
body {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../build/datatable/assets/skins/sam/datatable.css" />
|
||||
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
<script type="text/javascript" src="../../build/element/element-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datasource/datasource-beta-min.js"></script>
|
||||
<script type="text/javascript" src="../../build/datatable/datatable-beta-min.js"></script>
|
||||
|
||||
|
||||
<!--begin custom header content for this example-->
|
||||
<style type="text/css">
|
||||
#demo {
|
||||
width: 525px;
|
||||
}
|
||||
#pag {
|
||||
display: inline;
|
||||
float: left;
|
||||
width: 250px;
|
||||
margin-top: 0;
|
||||
}
|
||||
#pag a {
|
||||
color: #0000de;
|
||||
text-decoration: underline;
|
||||
padding: .5ex 0;
|
||||
}
|
||||
#pag label {
|
||||
display: block;
|
||||
margin: 1ex 0;
|
||||
}
|
||||
#pag p {
|
||||
margin: .25ex 0;
|
||||
}
|
||||
|
||||
.yui-skin-sam #pag .yui-pg-pages {
|
||||
display: block;
|
||||
}
|
||||
.yui-skin-sam #pag .yui-pg-page {
|
||||
display: block;
|
||||
background-color: #f1f6f7;
|
||||
background: transparent;
|
||||
border: none;
|
||||
white-space: normal;
|
||||
}
|
||||
.yui-skin-sam #pag .yui-pg-current-page {
|
||||
padding: .5ex 0;
|
||||
background-color: #ffe;
|
||||
font-style: italic;
|
||||
}
|
||||
.yui-skin-sam #pag .yui-pg-current {
|
||||
margin: 0;
|
||||
white-space: normal;
|
||||
font-weight: bold;
|
||||
font-size: 113%;
|
||||
}
|
||||
.yui-skin-sam #demo .yui-dt caption {
|
||||
margin: 0.2em 0 0;
|
||||
color: #e76300;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--end custom header content for this example-->
|
||||
|
||||
</head>
|
||||
|
||||
<body class=" yui-skin-sam">
|
||||
|
||||
<h1>Configuring the Paginator</h1>
|
||||
|
||||
<div class="exampleIntro">
|
||||
<p>This example demonstrates the various configuration options for the YAHOO.widget.Paginator class included with the DataTable. Note that all navigation in the left column is generated by the Paginator.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
<div id="demo">
|
||||
<div id="pag"></div>
|
||||
<div id="tbl"></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="assets/js/data.js"></script>
|
||||
<script type="text/javascript">
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
|
||||
// Sort our data by state, then area code
|
||||
var Data = YAHOO.example.Data.areacodes;
|
||||
Data.sort(function (a,b) {
|
||||
return YAHOO.util.Sort.compare(a.state,b.state) ||
|
||||
YAHOO.util.Sort.compare(a.areacode,b.areacode);
|
||||
});
|
||||
|
||||
// Custom function we'll use for the page links
|
||||
var buildPageLabel = function (recs) {
|
||||
var start = recs[0],
|
||||
end = recs[1];
|
||||
|
||||
// Nested function to find the smallest substring
|
||||
// to indicate how two strings differ
|
||||
var diffNames = function (a,b) {
|
||||
var aa = a.state.toLowerCase(),
|
||||
bb = b.state.toLowerCase();
|
||||
|
||||
for (var i = 0, len = aa.length; i < len; ++i) {
|
||||
if (aa.charAt(i) !== bb.charAt(i)) {
|
||||
return a.state.substr(0,i+1);
|
||||
}
|
||||
}
|
||||
|
||||
return a.state + ' ('+a.areacode+')';
|
||||
};
|
||||
|
||||
// Build label as "A - C" or "Abc - Def"
|
||||
var label = '';
|
||||
if (!start) {
|
||||
label = Data[0].state.substr(0,2) + ' - ';
|
||||
} else {
|
||||
label = diffNames(Data[start], Data[start-1]) + ' - ';
|
||||
}
|
||||
|
||||
if (Data[end+1]) {
|
||||
label += diffNames(Data[end], Data[end+1]);
|
||||
} else {
|
||||
label += diffNames(Data[end], Data[start]);
|
||||
}
|
||||
|
||||
return label;
|
||||
};
|
||||
|
||||
|
||||
// Paginator configurations
|
||||
var myPaginatorConfig = {
|
||||
// REQUIRED
|
||||
rowsPerPage : 20,
|
||||
|
||||
// REQUIRED, but DataTable will default if not provided
|
||||
containers : 'pag',
|
||||
|
||||
// If not provided, there is no last page or total pages.
|
||||
// DataTable will set this in the DataSource callback, so this is
|
||||
// redundant.
|
||||
totalRecords : Data.length,
|
||||
|
||||
// page to activate at load
|
||||
initialPage : 3,
|
||||
|
||||
// Class the element(s) that will contain the controls
|
||||
containerClass : 'yui-pg-container', // default
|
||||
|
||||
// Define the innerHTML of the container(s) using placeholders
|
||||
// to identify where the controls will be located
|
||||
template :
|
||||
'<h3>Now showing:</h3>' +
|
||||
'<p>{CurrentPageReport}</p>' +
|
||||
'<p class="pg-nav">' +
|
||||
'{FirstPageLink} {PreviousPageLink} ' +
|
||||
'{NextPageLink} {LastPageLink}' +
|
||||
'</p>' +
|
||||
'<label>Page size: {RowsPerPageDropdown}</label>' +
|
||||
'<h3>Directory</h3>' +
|
||||
'{PageLinks}',
|
||||
|
||||
// If there is less data than would display on one page, pagination
|
||||
// controls can be omitted by setting this to false.
|
||||
alwaysVisible : true, // default
|
||||
|
||||
// Override setPage (et al) to immediately update internal values
|
||||
// and update the pagination controls in response to user actions.
|
||||
// Default is false; requests are delegated through the changeRequest
|
||||
// event subscriber.
|
||||
updateOnChange : false, // default
|
||||
|
||||
// Options for FirstPageLink component
|
||||
firstPageLinkLabel : "<<",
|
||||
firstPageLinkClass : "yui-pg-first", // default
|
||||
|
||||
// Options for LastPageLink component
|
||||
lastPageLinkLabel : ">>",
|
||||
lastPageLinkClass : "yui-pg-last", // default
|
||||
|
||||
// Options for PreviousPageLink component
|
||||
previousPageLinkLabel : "< previous",
|
||||
previousPageLinkClass : "yui-pg-previous", // default
|
||||
|
||||
// Options for NextPageLink component
|
||||
nextPageLinkLabel : "next >", // default
|
||||
nextPageLinkClass : "yui-pg-next", // default
|
||||
|
||||
// Options for PageLinks component
|
||||
pageLinksContainerClass : 'yui-pg-pages', // default
|
||||
pageLinkClass : 'yui-pg-page', // default
|
||||
currentPageClass : 'yui-pg-current-page', // default
|
||||
|
||||
// Display a maximum of X page links. Use
|
||||
// YAHOO.widget.Paginator.VALUE_UNLIMITED to show all page links
|
||||
pageLinks : YAHOO.widget.Paginator.VALUE_UNLIMITED,
|
||||
|
||||
// Create custom page link labels
|
||||
pageLabelBuilder : function (page,paginator) {
|
||||
return buildPageLabel(paginator.getPageRecords(page));
|
||||
},
|
||||
|
||||
// Options for RowsPerPageDropdown component
|
||||
rowsPerPageDropdownClass : "yui-pg-rpp-options", // default
|
||||
rowsPerPageOptions : [
|
||||
{ value : 20, text : "small" },
|
||||
{ value : 40, text : "medium" },
|
||||
{ value : 100, text : "large" }
|
||||
],
|
||||
|
||||
// Options for CurrentPageReport component
|
||||
pageReportClass : 'yui-pg-current', // default
|
||||
|
||||
// Provide a key:value map for use by the pageReportTemplate.
|
||||
// Unlikely this will need to be customized; see API docs for the
|
||||
// template keys made available by the default value generator
|
||||
pageReportValueGenerator : function (paginator) {
|
||||
var recs = paginator.getPageRecords();
|
||||
|
||||
return {
|
||||
start : Data[recs[0]].state,
|
||||
end : Data[recs[1]].state
|
||||
};
|
||||
},
|
||||
|
||||
// How to render the notification of the Paginator's current state
|
||||
pageReportTemplate : '{start} - {end}'
|
||||
};
|
||||
|
||||
// Create the Paginator for our DataTable to use
|
||||
var myPaginator = new YAHOO.widget.Paginator(myPaginatorConfig);
|
||||
|
||||
|
||||
// Normal DataTable configuration
|
||||
var myColumnDefs = [ {key:"state", label:"State", minWidth: 150},
|
||||
{key:"areacode", label:"Code", width: 30}];
|
||||
|
||||
var myDataSource = new YAHOO.util.DataSource(Data);
|
||||
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
|
||||
myDataSource.responseSchema = {
|
||||
fields : ["state","areacode"]
|
||||
};
|
||||
|
||||
// Pass the Paginator in the DataTable config
|
||||
var myTableConfig = {
|
||||
paginator : myPaginator,
|
||||
caption : 'Area Codes by State'
|
||||
};
|
||||
|
||||
var myDataTable = new YAHOO.widget.DataTable('tbl',
|
||||
myColumnDefs, myDataSource, myTableConfig);
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--END SOURCE CODE FOR EXAMPLE =============================== -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue