Created
December 3, 2011 09:33
-
-
Save lovuikeng/1426675 to your computer and use it in GitHub Desktop.
SpringOne 2GX HTMLExpense client controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // source: https://github.com/SpringSource/html5expense/blob/master/client/www/controller.js | |
| document.addEventListener('deviceready', onDeviceReady, false); | |
| function onDeviceReady() { | |
| pictureSource = navigator.camera.PictureSourceType; | |
| destinationType = navigator.camera.DestinationType; | |
| ... | |
| } | |
| $('#create-new-add-receipt').live('pagecreate', function(event) { | |
| $('#create-new-add-receipt-capture-photo').click(function() { | |
| navigator.camera.getPicture(onPhotoCaptureSuccess, onPhotoCaptureError, { | |
| quality : imageQuality, | |
| targetWidth : imageWidth, | |
| destinationType : destinationType.FILE_URI | |
| }); | |
| return false; | |
| }); | |
| ... | |
| }); | |
| function onPhotoCaptureSuccess(imageURI) { | |
| $.mobile.showPageLoadingMsg(); | |
| var image = document.getElementById('receiptImage'); | |
| image.src = imageURI; | |
| ... | |
| var url = getApiUrl('reports/' + expenseReport.id + '/expenses/' + expense.id + '/receipt'); | |
| // PhoneGap component | |
| var fileTransfer = new FileTransfer(); | |
| fileTransfer.upload(imageURI, url, onFileTransferSuccess, onFileTransferError, opts); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment