Permalink
Browse files

Update for 1.11.5 Release for new 2011 Session

  • Loading branch information...
NY Senate CIO Office
NY Senate CIO Office committed Jan 8, 2011
1 parent 06d352d commit 41204ee6e626b6b384b697cadc8b2eab8190270d
Showing with 3,118 additions and 1,569 deletions.
  1. BIN Resources/{views/window → }/.DS_Store
  2. BIN Resources/android/images/res-long-land-hdpi/default.png
  3. BIN Resources/android/images/res-long-land-ldpi/default.png
  4. BIN Resources/android/images/res-long-port-hdpi/default.png
  5. BIN Resources/android/images/res-long-port-ldpi/default.png
  6. BIN Resources/android/images/res-notlong-land-hdpi/default.png
  7. BIN Resources/android/images/res-notlong-land-ldpi/default.png
  8. BIN Resources/android/images/res-notlong-land-mdpi/default.png
  9. BIN Resources/android/images/res-notlong-port-hdpi/default.png
  10. BIN Resources/android/images/res-notlong-port-ldpi/default.png
  11. BIN Resources/android/images/res-notlong-port-mdpi/default.png
  12. +14 −15 Resources/app.js
  13. BIN Resources/appicon@2x.png
  14. +146 −35 Resources/{inc → }/globals.js
  15. BIN Resources/img/.DS_Store
  16. BIN Resources/img/senators/(02-04-09) Adams-HS-059NEW HEADSHOT_1.JPG
  17. BIN Resources/img/senators/(02-05-09) Perkins-HS-004_0.jpg
  18. BIN Resources/img/senators/(02-11-09) Dilan-HS-046.jpg
  19. BIN Resources/img/senators/(03-03-09) Huntley-HS-015_1.jpg
  20. BIN Resources/img/senators/(03-03-09) Savino-HS-019.jpg
  21. BIN Resources/img/senators/(03-05-09) Squadron HS-040.jpg
  22. BIN Resources/img/senators/(03-09-09) Stewart-Cousins HS-016.jpg
  23. BIN Resources/img/senators/(12-07-10) Carlucci-HS-028.jpg
  24. BIN Resources/img/senators/148791_10150090738830786_723005785_7922082_6685808_n.jpg
  25. BIN Resources/img/senators/2.jpg
  26. BIN Resources/img/senators/2009 Sen Seward Head Shot.jpg
  27. BIN Resources/img/senators/2010-8-5.FOR WEB PAGE.jpg
  28. BIN Resources/img/senators/24x7@300dpi.jpg
  29. BIN Resources/img/senators/42ProfilePic Bonacic.jpg
  30. BIN Resources/img/senators/Addabbo.SD15.jpg
  31. BIN Resources/img/senators/Avella Website Photo.jpg
  32. BIN Resources/img/senators/BIOShotOppenheimer2007newheadshotcolor.jpg
  33. BIN Resources/img/senators/Breslin202009.jpg
  34. BIN Resources/img/senators/Diaz-HS-2009.jpg
  35. BIN Resources/img/senators/DuaneHeadshot07ColorBIO.jpg
  36. BIN Resources/img/senators/Giannaris.jpg
  37. BIN Resources/img/senators/HEADSHOT-CK 2009_0.JPG
  38. BIN Resources/img/senators/JK_Headshot_2009mp.jpg
  39. BIN Resources/img/senators/Jose Peralta MAIN-Senate headshot.JPG
  40. BIN Resources/img/senators/KLavalle.jpg
  41. BIN Resources/img/senators/Kennedy,Tim.jpg
  42. BIN Resources/img/senators/Libous.jpg
  43. BIN Resources/img/senators/Montgomery May Headshot 2_0.jpg
  44. BIN Resources/img/senators/Official Website Headshot_0.jpg
  45. BIN Resources/img/senators/Parker2007Biography.jpg
  46. BIN Resources/img/senators/SD22_Golden.jpg
  47. BIN Resources/img/senators/SD41_Saland.jpg
  48. BIN Resources/img/senators/SD43_McDonald.jpg
  49. BIN Resources/img/senators/SD44_Farley.jpg
  50. BIN Resources/img/senators/SD47_Griffo.jpg
  51. BIN Resources/img/senators/SD4_Johnson.jpg
  52. BIN Resources/img/senators/SD50_Defrancisco.jpg
  53. BIN Resources/img/senators/SD56_Robach.jpg
  54. BIN Resources/img/senators/SD62_Maziarz_0.jpg
  55. BIN Resources/img/senators/SD9_Skelos_4.jpg
  56. BIN Resources/img/senators/Senate Headshot.jpg
  57. BIN Resources/img/senators/Senator Alesi - 55th- Headshot 6-2008.JPG
  58. BIN Resources/img/senators/Smith-HS-024.jpg
  59. BIN Resources/img/senators/Valesky-HSmp.jpg
  60. BIN Resources/img/senators/WebBio Hassell-ThompsonHS.jpg
  61. BIN Resources/img/senators/andrea-stewart-cousins.jpg
  62. BIN Resources/img/senators/andrew-j-lanza.jpg
  63. BIN Resources/img/senators/antoine-m-thompson.jpg
  64. BIN Resources/img/senators/ball_web.jpg
  65. BIN Resources/img/senators/bill-perkins.jpg
  66. BIN Resources/img/senators/brian-x-foley.jpg
  67. BIN Resources/img/senators/carl-kruger.jpg
  68. BIN Resources/img/senators/carl-l-marcellino.jpg
  69. BIN Resources/img/senators/catharine-young.jpg
  70. BIN Resources/img/senators/charles-j-fuschillo-jr.jpg
  71. BIN Resources/img/senators/craig-m-johnson.jpg
  72. BIN Resources/img/senators/dale-m-volker.jpg
  73. BIN Resources/img/senators/daniel-l-squadron.jpg
  74. BIN Resources/img/senators/darrel-j-aubertine.jpg
  75. BIN Resources/img/senators/david-j-valesky.jpg
  76. BIN Resources/img/senators/dean-g-skelos.jpg
  77. BIN Resources/img/senators/diane-j-savino.jpg
  78. BIN Resources/img/senators/elizabeth-little.jpg
  79. BIN Resources/img/senators/eric-adams.jpg
  80. BIN Resources/img/senators/eric-t-schneiderman.jpg
  81. BIN Resources/img/senators/esp.jpg
  82. BIN Resources/img/senators/forwebBROCHURESSENATORFUSCHILLO'SOFFICIALHEADSHOT.jpg
  83. BIN Resources/img/senators/frank-padavan.jpg
  84. BIN Resources/img/senators/gallivan_web.jpg
  85. BIN Resources/img/senators/george-d-maziarz.jpg
  86. BIN Resources/img/senators/george-h-winner-jr.jpg
  87. BIN Resources/img/senators/george-onorato.jpg
  88. BIN Resources/img/senators/grisanti_web.jpg
  89. BIN Resources/img/senators/hannon.jpg
  90. BIN Resources/img/senators/head.JPG
  91. BIN Resources/img/senators/headshotWEB.jpg
  92. BIN Resources/img/senators/hs.jpg
  93. BIN Resources/img/senators/hugh-t-farley.jpg
  94. BIN Resources/img/senators/james-l-seward.jpg
  95. BIN Resources/img/senators/james-s-alesi.jpg
  96. BIN Resources/img/senators/jeffrey-d-klein.jpg
  97. BIN Resources/img/senators/john-defrancisco.jpg
  98. BIN Resources/img/senators/john-j-bonacic.jpg
  99. BIN Resources/img/senators/john-j-flanagan.jpg
  100. BIN Resources/img/senators/john-l-sampson.jpg
  101. BIN Resources/img/senators/jose-m-serrano.jpg
  102. BIN Resources/img/senators/jose-peralta.jpg
  103. BIN Resources/img/senators/joseph-e-robach.jpg
  104. BIN Resources/img/senators/joseph-griffo.jpg
  105. BIN Resources/img/senators/joseph-p-addabbo-jr.jpg
  106. BIN Resources/img/senators/kemp-hannon.jpg
  107. BIN Resources/img/senators/kenneth-p-lavalle.jpg
  108. BIN Resources/img/senators/kevin-s-parker.jpg
  109. BIN Resources/img/senators/liz-krueger.jpg
  110. BIN Resources/img/senators/malcolm-smith.jpg
  111. BIN Resources/img/senators/martin-j-golden.jpg
  112. BIN Resources/img/senators/martin-malave-dilan.jpg
  113. BIN Resources/img/senators/martins_web.jpg
  114. BIN Resources/img/senators/michael-f-nozzolio.jpg
  115. BIN Resources/img/senators/michael-h-ranzenhofer.jpg
  116. BIN Resources/img/senators/neil-d-breslin.jpg
  117. BIN Resources/img/senators/omara_web.jpg
  118. BIN Resources/img/senators/openwordlogo.gif
  119. BIN Resources/img/senators/owen-h-johnson.jpg
  120. BIN Resources/img/senators/pedro-espada-jr.jpg
  121. BIN Resources/img/senators/ritchie_web.jpg
  122. BIN Resources/img/senators/roy-j-mcdonald.jpg
  123. BIN Resources/img/senators/ruben-diaz.jpg
  124. BIN Resources/img/senators/ruth-hassell-thompson.jpg
  125. BIN Resources/img/senators/serranoheadshot.JPG
  126. BIN Resources/img/senators/shirley-l-huntley.jpg
  127. BIN Resources/img/senators/small/andrea-stewart-cousins.jpg
  128. BIN Resources/img/senators/small/andrew-j-lanza.jpg
  129. BIN Resources/img/senators/small/antoine-m-thompson.jpg
  130. BIN Resources/img/senators/small/bill-perkins.jpg
  131. BIN Resources/img/senators/small/brian-x-foley.jpg
  132. BIN Resources/img/senators/small/carl-kruger.jpg
  133. BIN Resources/img/senators/small/carl-l-marcellino.jpg
  134. BIN Resources/img/senators/small/catharine-young.jpg
  135. BIN Resources/img/senators/small/charles-j-fuschillo-jr.jpg
  136. BIN Resources/img/senators/small/craig-m-johnson.jpg
  137. BIN Resources/img/senators/small/dale-m-volker.jpg
  138. BIN Resources/img/senators/small/daniel-l-squadron.jpg
  139. BIN Resources/img/senators/small/darrel-j-aubertine.jpg
  140. BIN Resources/img/senators/small/david-j-valesky.jpg
  141. BIN Resources/img/senators/small/dean-g-skelos.jpg
  142. BIN Resources/img/senators/small/diane-j-savino.jpg
  143. BIN Resources/img/senators/small/elizabeth-little.jpg
  144. BIN Resources/img/senators/small/eric-adams.jpg
  145. BIN Resources/img/senators/small/eric-t-schneiderman.jpg
  146. BIN Resources/img/senators/small/frank-padavan.jpg
  147. BIN Resources/img/senators/small/george-d-maziarz.jpg
  148. BIN Resources/img/senators/small/george-h-winner-jr.jpg
  149. BIN Resources/img/senators/small/george-onorato.jpg
  150. BIN Resources/img/senators/small/hugh-t-farley.jpg
  151. BIN Resources/img/senators/small/james-l-seward.jpg
  152. BIN Resources/img/senators/small/james-s-alesi.jpg
  153. BIN Resources/img/senators/small/jeffrey-d-klein.jpg
  154. BIN Resources/img/senators/small/john-defrancisco.jpg
  155. BIN Resources/img/senators/small/john-j-bonacic.jpg
  156. BIN Resources/img/senators/small/john-j-flanagan.jpg
  157. BIN Resources/img/senators/small/john-l-sampson.jpg
  158. BIN Resources/img/senators/small/jose-m-serrano.jpg
  159. BIN Resources/img/senators/small/jose-peralta.jpg
  160. BIN Resources/img/senators/small/joseph-e-robach.jpg
  161. BIN Resources/img/senators/small/joseph-griffo.jpg
  162. BIN Resources/img/senators/small/joseph-p-addabbo-jr.jpg
  163. BIN Resources/img/senators/small/kemp-hannon.jpg
  164. BIN Resources/img/senators/small/kenneth-p-lavalle.jpg
  165. BIN Resources/img/senators/small/kevin-s-parker.jpg
  166. BIN Resources/img/senators/small/liz-krueger.jpg
  167. BIN Resources/img/senators/small/malcolm-smith.jpg
  168. BIN Resources/img/senators/small/martin-j-golden.jpg
  169. BIN Resources/img/senators/small/martin-malave-dilan.jpg
  170. BIN Resources/img/senators/small/michael-f-nozzolio.jpg
  171. BIN Resources/img/senators/small/michael-h-ranzenhofer.jpg
  172. BIN Resources/img/senators/small/neil-d-breslin.jpg
  173. BIN Resources/img/senators/small/owen-h-johnson.jpg
  174. BIN Resources/img/senators/small/pedro-espada-jr.jpg
  175. BIN Resources/img/senators/small/roy-j-mcdonald.jpg
  176. BIN Resources/img/senators/small/ruben-diaz.jpg
  177. BIN Resources/img/senators/small/ruth-hassell-thompson.jpg
  178. BIN Resources/img/senators/small/shirley-l-huntley.jpg
  179. BIN Resources/img/senators/small/stephen-m-saland.jpg
  180. BIN Resources/img/senators/small/suzi-oppenheimer.jpg
  181. BIN Resources/img/senators/small/thomas-duane.jpg
  182. BIN Resources/img/senators/small/thomas-p-morahan.jpg
  183. BIN Resources/img/senators/small/toby-ann-stavisky.jpg
  184. BIN Resources/img/senators/small/tom-libous.jpg
  185. BIN Resources/img/senators/small/velmanette-montgomery.jpg
  186. BIN Resources/img/senators/small/vincent-l-leibell.jpg
  187. BIN Resources/img/senators/small/william-j-larkin-jr.jpg
  188. BIN Resources/img/senators/small/william-j-larkin.jpg
  189. BIN Resources/img/senators/small/william-t-stachowski.jpg
  190. BIN Resources/img/senators/stephen-m-saland.jpg
  191. BIN Resources/img/senators/suzi-oppenheimer.jpg
  192. BIN Resources/img/senators/thomas-duane.jpg
  193. BIN Resources/img/senators/thomas-p-morahan.jpg
  194. BIN Resources/img/senators/toby-ann-stavisky.jpg
  195. BIN Resources/img/senators/tom-libous.jpg
  196. BIN Resources/img/senators/velmanette-montgomery.jpg
  197. BIN Resources/img/senators/vincent-l-leibell.jpg
  198. BIN Resources/img/senators/webphoto1.jpg
  199. BIN Resources/img/senators/william-j-larkin-jr.jpg
  200. BIN Resources/img/senators/william-j-larkin.jpg
  201. BIN Resources/img/senators/william-t-stachowski.jpg
  202. BIN Resources/img/senators/young headshot-ret.jpg
  203. BIN Resources/img/senators/zeldin.jpg
  204. BIN Resources/{img/senators → inc}/.DS_Store
  205. +64 −0 Resources/inc/drupal_services.js
  206. +313 −0 Resources/inc/jssha256.js
  207. +103 −0 Resources/inc/map.js
  208. +30 −31 Resources/{views/window → inc}/rss.js
  209. +45 −32 Resources/{views/window/findsenator.js → inc/seeclickfix.js}
  210. 0 Resources/{views/window → inc}/videos-blip.js
  211. +33 −112 Resources/{views/window/videos.js → inc/youtube.js}
  212. BIN Resources/iphone/.DS_Store
  213. +0 −341 Resources/iphone/MainWindow.xib
  214. +0 −353 Resources/iphone/MainWindow_ipad.xib
  215. BIN Resources/iphone/appicon@2x.png
  216. BIN Resources/views/.DS_Store
  217. 0 Resources/views/{window → }/calevent.js
  218. +24 −10 Resources/views/{window → }/committees.js
  219. +406 −0 Resources/views/findsenator.js
  220. +1 −1 Resources/views/{window → }/home-android.js
  221. +1 −1 Resources/views/{window → }/home-coverflow.js
  222. +5 −5 Resources/views/{window → }/home-ipad-nav.js
  223. +14 −95 Resources/views/{window → }/home-ipad.js
  224. +1 −1 Resources/views/{window → }/home-webview.js
  225. +6 −6 Resources/views/{window → }/home.js
  226. +814 −0 Resources/views/homeslider.js
  227. +15 −21 Resources/views/{window → }/legislation.js
  228. 0 Resources/views/{window → }/more-dash.js
  229. +1 −1 Resources/views/{window → }/more.js
  230. +3 −3 Resources/views/{window/olsearch-json.js → olsearch.js}
  231. +70 −40 Resources/views/{window → }/senator.js
  232. +377 −0 Resources/views/senators-android.js
  233. +281 −0 Resources/views/senators-ipad.js
  234. +320 −0 Resources/views/senators.js
  235. 0 Resources/views/{window → }/today-demo.js
  236. +1 −1 Resources/views/{window → }/today.js
  237. +5 −2 Resources/views/{window → }/videos-boxes.js
  238. 0 Resources/views/{window → }/welcome.js
  239. +0 −152 Resources/views/window/senators-android.js
  240. +0 −188 Resources/views/window/senators-ipad.js
  241. +0 −113 Resources/views/window/senators.js
  242. +5 −5 manifest
  243. +20 −5 tiapp.xml
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -5,29 +5,29 @@ Titanium.UI.setBackgroundColor('#fff');
-
-
// create table view data object
var tdata = [
- {title:'Senate Home',ilink:'views/window/home-ipad.js',leftImage:'img/tabs/bank.png',navBarHidden:true, className:'menuRow'},
- {title:'Senate Calendar',ilink:'views/window/today.js',leftImage:'img/tabs/clock.png',navBarHidden:false, className:'menuRow'},
- {title:'Senators',hasChild:true,mlink:'views/window/senators-android.js',leftImage:'img/tabs/man.png',navBarHidden:false, className:'menuRow'},
- {title:'Open Legislation',ilink:'views/window/legislation.js',leftImage:'img/tabs/database.png',navBarHidden:false, className:'menuRow'},
- {title:'Committee Activity',ilink:'views/window/committees.js',leftImage:'img/tabs/connections.png',navBarHidden:false, className:'menuRow'},
- {title:'Official Blog',hasDetail:false, rss:'http://www.nysenate.gov/blog/feed',navBarHidden:false, leftImage:'img/tabs/newspaper.png', className:'menuRow'},
+ {title:'Senate Home',ilink:'views/home-ipad.js',leftImage:'img/tabs/bank.png',navBarHidden:true, className:'menuRow'},
+ {title:'Senate Calendar',ilink:'views/today.js',leftImage:'img/tabs/clock.png',navBarHidden:false, className:'menuRow'},
+ {title:'Senators',hasChild:true,mlink:'views/senators.js',leftImage:'img/tabs/man.png',navBarHidden:false, className:'menuRow'},
+ {title:'Open Legislation',ilink:'views/legislation.js',leftImage:'img/tabs/database.png',navBarHidden:false, className:'menuRow'},
+ {title:'Committee Activity',ilink:'views/committees.js',leftImage:'img/tabs/connections.png',navBarHidden:false, className:'menuRow'},
+// {title:'Newsroom',hasDetail:false, ilink:'views/homeslider.js',navBarHidden:false, leftImage:'img/tabs/newspaper.png', className:'menuRow'},
+
+// {title:'Official Blog',hasDetail:false, rss:'http://www.nysenate.gov/blog/feed',navBarHidden:false, leftImage:'img/tabs/newspaper.png', className:'menuRow'},
/*{title:'Open Data Search',elink:'http://www.nysenate.gov/opendata',leftImage:'img/tabs/search.png',navBarHidden:false},*/
- {title:'Video Gallery',ilink:'views/window/videos-boxes.js',leftImage:'img/tabs/star.png',navBarHidden:false, className:'menuRow'},
+ {title:'Video Gallery',ilink:'views/videos-boxes.js',leftImage:'img/tabs/star.png',navBarHidden:false, className:'menuRow'},
{title:'Issues & Initiatives',link:'http://www.nysenate.gov/issues-initiatives',leftImage:'img/tabs/newspaper.png',navBarHidden:false, className:'menuRow'},
/* {title:'Daily Newsclips (Beta)', elink:'http://newsclips.senate.state.ny.us/names.jsp',navBarHidden:false, leftImage:'img/tabs/newspaper.png', className:'menuRow'},
*/
{title:'@NYSenate', elink:'http://m.twitter.com/nysenate',leftImage:'img/tabs/speechbubble.png',navBarHidden:false, className:'menuRow'},
- {title:'Senate Reports', link:'http://www.nysenate.gov/reports',navBarHidden:false,leftImage:'img/tabs/folder.png', className:'menuRow'},
+// {title:'Senate Reports', link:'http://www.nysenate.gov/reports',navBarHidden:false,leftImage:'img/tabs/folder.png', className:'menuRow'},
{title:'Contact the Senate', elink:'http://www.nysenate.gov/contact_form',leftImage:'img/tabs/newspaper.png',navBarHidden:false, className:'menuRow'},
{title:'---------------', className:'menuRow'},
{title:'About the Senate', hasDetail:true, link:'http://www.nysenate.gov/about-us',navBarHidden:false, className:'menuRow'},
{title:'Frequently Asked Questions', hasDetail:true, link:'http://www.nysenate.gov/frequently-asked-questions',navBarHidden:false, className:'menuRow'},
- {title:'FOIL Request', hasDetail:true, link:'http://www.nysenate.gov/foil_request',navBarHidden:false, className:'menuRow'},
+ {title:'FOIL Request', hasDetail:true, elink:'http://www.nysenate.gov/foil_request',navBarHidden:false, className:'menuRow'},
{title:'Visiting the Capitol', hasDetail:true, link:'http://www.nysenate.gov/node/76',navBarHidden:false, className:'menuRow'},
/* {title:'Capitol Map', hasDetail:true, elink:'http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=ny+state+capitol&sll=37.0625,-95.677068&sspn=34.534108,75.498047&ie=UTF8&hq=ny+state+capitol&hnear=&ll=42.653783,-73.756628&spn=0.03131,0.10643&z=14&iwloc=A',navBarHidden:false},*/
{title:'Senate Rules', hasDetail:true, link:'http://www.nysenate.gov/rules',navBarHidden:false, className:'menuRow'},
@@ -41,8 +41,7 @@ var tdata = [
// create table view
var tableViewOptions = {
-
- data:tdata
+ data:tdata
};
@@ -179,7 +178,7 @@ masterViewTable.addEventListener('click', function(e)
var subWin = Titanium.UI.createWindow({
- url:'views/window/rss.js',
+ url:'inc/rss.js',
title:tdata[e.index].title,
barColor:DEFAULT_BAR_COLOR,
rss:tdata[e.index].rss,
@@ -202,7 +201,7 @@ var winHome;
winHome = Titanium.UI.createWindow({
title:'Home',
- url:'views/window/home-ipad.js',
+ url:'views/home-ipad.js',
navBarHidden:false,
barColor:DEFAULT_BAR_COLOR
});
View
Binary file not shown.
@@ -36,18 +36,23 @@ function getSenatorJSON ()
if (!senatorJson)
{
Titanium.API.info("loading senators json");
-
- var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'senators.json');
- var contents = file.read();
-
- Titanium.API.info("parsing senators json");
- senatorJson = JSON.parse(contents.text);
+ var cachedFeed = getCachedFile("senatorsJson");
+
+ // Titanium.API.info("parsing senators json: " + cachedFeed);
+
+ if (cachedFeed)
+ {
+ senatorJson = JSON.parse('{"data":' + cachedFeed + '}').data;
+
+ }
+
}
return senatorJson;
}
+
function processHtml (rawHTML)
{
rawHTML=rawHTML.replace(/<br>/gi, " ");
@@ -380,51 +385,92 @@ function showNYSenateContent(wTitle, wUrl,detailView)
};
-function getCachedFile (fileUrl)
+function getCachedFile (cacheUrl)
{
- var filename = Titanium.Utils.md5HexDigest(fileUrl);
- var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
- if (f.exists())
- return f;
- else
+ var filename = Titanium.Utils.md5HexDigest(cacheUrl);
+
+ try
+ {
+ // Ti.API.debug('looking for cached file md5: ' + filename);
+
+ var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
+
+ if (f)
+ {
+ // Ti.API.debug('found cached file: ' + f.nativePath);
+ return f.read();
+ }
+ else
+ return null;
+ }
+ catch (E)
+ {
+ //Ti.API.debug('no cache for: ' + cacheUrl);
return null;
+ }
+
+ return null;
}
-function cacheFile (fileUrl)
+function cacheFile (fileUrl, fileData, fileCallbackFunction)
{
- var c = Titanium.Network.createHTTPClient();
-
- c.setTimeout(10000);
-
- c.onload = function()
+ if (fileData)
{
-
var filename = Titanium.Utils.md5HexDigest(fileUrl);
- var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
- f.write(this.responseData);
-
- };
+
+ //Ti.API.debug('saving file ' + fileUrl + ' as : ' + filename);
- c.ondatastream = function(e)
- {
- //ind.value = e.progress ;
- };
+ var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
+
+ f.write(fileData);
+
+ if(fileCallbackFunction)
+ fileCallbackFunction(fileUrl,f);
- c.error = function(e)
+ }
+ else
{
- //Ti.UI.createAlertDialog({title:'XHR', message:'Error: ' + e.error}).show();
- };
-
- c.open('GET', fileUrl);
-
- // send the data
- c.send();
+ var c = Titanium.Network.createHTTPClient();
+
+ c.setTimeout(30000);
+
+ c.onload = function()
+ {
+ var filename = Titanium.Utils.md5HexDigest(fileUrl);
+
+ //Ti.API.info('saving file ' + fileUrl + ' as : ' + filename);
+ var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,filename);
+
+ f.write(this.responseData);
+
+ if(fileCallbackFunction)
+ fileCallbackFunction(fileUrl,f);
+
+ };
+
+ c.ondatastream = function(e)
+ {
+ //ind.value = e.progress ;
+ //Ti.API.info('ONDATASTREAM1 - PROGRESS: ' + e.progress);
+ };
+
+ c.error = function(e)
+ {
+ //Ti.UI.createAlertDialog({title:'XHR', message:'Error: ' + e.error}).show();
+ //Ti.API.debug('ONDATASTREAM1 - ERROR: ' + e.error);
+ };
+
+ c.open('GET', fileUrl);
+
+ // send the data
+ c.send();
+ }
}
@@ -438,3 +484,68 @@ function trim(s)
return s.substring(l, r+1);
}
+// Simulates PHP's date function
+Date.prototype.format = function(format) {
+ var returnStr = '';
+ var replace = Date.replaceChars;
+ for (var i = 0; i < format.length; i++) {
+ var curChar = format.charAt(i);
+ if (replace[curChar]) {
+ returnStr += replace[curChar].call(this);
+ } else {
+ returnStr += curChar;
+ }
+ }
+ return returnStr;
+};
+Date.replaceChars = {
+ shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ longMonths: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ shortDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ longDays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+
+ // Day
+ d: function() { return (this.getDate() < 10 ? '0' : '') + this.getDate(); },
+ D: function() { return Date.replaceChars.shortDays[this.getDay()]; },
+ j: function() { return this.getDate(); },
+ l: function() { return Date.replaceChars.longDays[this.getDay()]; },
+ N: function() { return this.getDay() + 1; },
+ S: function() { return (this.getDate() % 10 == 1 && this.getDate() != 11 ? 'st' : (this.getDate() % 10 == 2 && this.getDate() != 12 ? 'nd' : (this.getDate() % 10 == 3 && this.getDate() != 13 ? 'rd' : 'th'))); },
+ w: function() { return this.getDay(); },
+ z: function() { return "Not Yet Supported"; },
+ // Week
+ W: function() { return "Not Yet Supported"; },
+ // Month
+ F: function() { return Date.replaceChars.longMonths[this.getMonth()]; },
+ m: function() { return (this.getMonth() < 9 ? '0' : '') + (this.getMonth() + 1); },
+ M: function() { return Date.replaceChars.shortMonths[this.getMonth()]; },
+ n: function() { return this.getMonth() + 1; },
+ t: function() { return "Not Yet Supported"; },
+ // Year
+ L: function() { return (((this.getFullYear()%4==0)&&(this.getFullYear()%100 != 0)) || (this.getFullYear()%400==0)) ? '1' : '0'; },
+ o: function() { return "Not Supported"; },
+ Y: function() { return this.getFullYear(); },
+ y: function() { return ('' + this.getFullYear()).substr(2); },
+ // Time
+ a: function() { return this.getHours() < 12 ? 'am' : 'pm'; },
+ A: function() { return this.getHours() < 12 ? 'AM' : 'PM'; },
+ B: function() { return "Not Yet Supported"; },
+ g: function() { return this.getHours() % 12 || 12; },
+ G: function() { return this.getHours(); },
+ h: function() { return ((this.getHours() % 12 || 12) < 10 ? '0' : '') + (this.getHours() % 12 || 12); },
+ H: function() { return (this.getHours() < 10 ? '0' : '') + this.getHours(); },
+ i: function() { return (this.getMinutes() < 10 ? '0' : '') + this.getMinutes(); },
+ s: function() { return (this.getSeconds() < 10 ? '0' : '') + this.getSeconds(); },
+ // Timezone
+ e: function() { return "Not Yet Supported"; },
+ I: function() { return "Not Supported"; },
+ O: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + '00'; },
+ P: function() { return (-this.getTimezoneOffset() < 0 ? '-' : '+') + (Math.abs(this.getTimezoneOffset() / 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() / 60)) + ':' + (Math.abs(this.getTimezoneOffset() % 60) < 10 ? '0' : '') + (Math.abs(this.getTimezoneOffset() % 60)); },
+ T: function() { var m = this.getMonth(); this.setMonth(0); var result = this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/, '$1'); this.setMonth(m); return result;},
+ Z: function() { return -this.getTimezoneOffset() * 60; },
+ // Full Date/Time
+ c: function() { return this.format("Y-m-d") + "T" + this.format("H:i:sP"); },
+ r: function() { return this.toString(); },
+ U: function() { return this.getTime() / 1000; }
+};
+
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
View